iphone - 在 mailcomposer 中向 html 正文添加新行

标签 iphone html iphone-sdk-3.0 mfmailcomposeviewcontroller

我如何在邮件编辑器的 html 正文中添加换行符?

我有一个字符串:

NSString *emailBody = [NSString stringWithFormat:@"<html><b>%%0D%%0AHello,%%0D%%0AHere's a link to your product%%0D%%0A<a href=\"%@\">click here</a>%%0D%%0A best regards</b></html>", currentProduct.url_product_details];

[picker setMessageBody:emailBody isHTML:YES];

当我设置邮件编辑器的正文时,我看到它没有换行。 我如何使新行出现?

TIA

最佳答案

在 HTML 中,换行符是 <br /> , 不是 %0D%0A .

并使用 <p>...</p>一段。

例如,

NSString* emailBody = [NSString stringWithFormat:
 @"<html><head></head><body style='font-weight:bold;'>"
 @"<p>Hello,</p>"
 @"<p>Here's a link to your product<br /><a href='%@'>click here</a></p>"
 @"<p>Best Regards</p>"
 @"</body></html>", currentProduct.url_product_details];

关于iphone - 在 mailcomposer 中向 html 正文添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2652847/

相关文章:

python - 名称错误 'html' 未使用 beautifulsoup4 定义

html - 如何根据用户在页面上向上或向下滚动的距离来使对象出现和消失?

objective-c - 使用 iPhone SDK 获取用户输入的文本并将其保存在网络服务器上

ios - 拿起 iOS 设备时获得回调

iphone - 如何在 tableview 中获取 youtube 嵌入式视频并在处理 "Done"按钮时遇到问题

iPhone 我如何知道用户何时触摸屏幕但没有移动?

iphone - 图像并排在数组 xcode 中(在 UITableViewCell 中)

javascript - 悬停图像,播放特定视频

iphone - 如何将 UILocatNotification 设置为每天早上 9 点触发

iphone - 使用 UIActivityIndi​​catorView 覆盖 View 的示例