我想使用 MFMailComposeViewController 通过电子邮件发送文本大纲。我目前正在通过创建文档的 HTML 版本并将其设置为邮件正文来执行此操作。这在 MFMailComposeViewController 中查看电子邮件时效果很好,但在接收端(MobileMail.app、GMail Web 界面、OSX 邮件。 app) 格式丢失。
这是我当前的代码:
- (IBAction)showMailController {
if (![MFMailComposeViewController canSendMail]) return;
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
mailComposeViewController.mailComposeDelegate = self;
NSString *stringRepresentation = @"<html><head></head><body><ul><li>@grocery</li><ul><li>Milk</li><li>Cat food</li><li>Rice</li><li>Tofu</li></ul></ul></body></html>";
[mailComposeViewController setMessageBody:stringRepresentation isHTML:YES];
[self presentModalViewController:mailComposeViewController animated:YES];
[mailComposeViewController release];
}
我做错了什么吗?还有其他方法吗?
我还尝试导出为带有手动缩进的简单文本大纲(我插入了两个空格,因为制表符不起作用),但文本编辑器无法将其识别为大纲。
NSMutableString *inset = [[NSMutableString alloc] init];
NSUInteger i;
for (i=0; i<insetCount;i++) {
[inset appendString:@" "];
}
NSMutableString *string = [[NSMutableString alloc] initWithString: [NSString stringWithFormat:@"%@%C ", inset, 0x2022]];
感谢您的帮助!
最佳答案
在我的应用程序中,我只将 body 标签之间的内容放在一起,即 NO
html
head
body
标签。只需将您通常会放在 body 标签之间的东西放在一起,它就会起作用。
关于iphone - 使用 MFMailComposeViewController 将大纲作为电子邮件发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1465421/