MFMailComposeViewController的Localizable.strings中的换行符

web*_*cke 4 xcode line-breaks localizable.strings ios mfmailcomposeviewcontroller

如何在我的语言文件中添加换行符以供使用MFMailComposeViewController?在\n我doesent工作.使用返回键上的正常klick中断具有相同的结果,没有换行符!


我的档案:

"Body_eMail"= "Hello, here is some text.\n\nLorem ipsum alsu.\n\nAnd some text, more...";
Run Code Online (Sandbox Code Playgroud)

我想要:

你好,

这是一些文字.Lorem ipsum alsu.

还有一些文字,更多......


本作的UILabel工作正常(如@lawicko下文提到),但加入到时MFMailComposeViewController\n字符内置显示,如下图所示:

Hello, here is some text.\n\nLorem ipsum alsu.\n\nAnd some text, more...

什么是正确的方法?

Joe*_*tti 6

首先确保您MFMailComposeViewControllerisHTML:YES设置.

MFMailComposeViewController *emailView = [[MFMailComposeViewController alloc] init];
NSString *emailBody = NSLocalizedString(@"Email Body", @"");
[emailView setMessageBody:emailBody isHTML:YES];

[self presentModalViewController:emailView animated:YES];
Run Code Online (Sandbox Code Playgroud)

在您的工作中,Localizable.strings您必须使用HTML <br />标记来生成换行符.

"emailBody" = "Hello, here is some text.<br /><br />Lorem ipsum alsu.<br /><br />And some text, more...";
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述