我如何在邮件编辑器的 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/