【问题标题】:Send outline as email using MFMailComposeViewController使用 MFMailComposeViewController 将大纲作为电子邮件发送
【发布时间】:2009-09-23 11:30:53
【问题描述】:

我想使用 MFMailComposeViewController 通过电子邮件发送文本大纲。我目前正在通过创建文档的 HTML 版本并将其设置为邮件正文来执行此操作。这在 MFMailComposeViewController 中查看电子邮件时效果很好,但在接收端(MobileMail.app、GMail Webinterface、OSX Mail。 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]];

感谢您的帮助!

【问题讨论】:

  • 跟进:发布此问题后不久,打开了一个仍然打开的雷达:radar://7242405,我现在将大纲作为文本附件附加到电子邮件中。

标签: iphone ios email iphone-sdk-3.0 mfmailcomposeviewcontroller


【解决方案1】:

在我的应用程序中,我只将正文标签之间的内容,即 NO

html    
head
body

标签。只需将您通常放在body标签之间的东西放在一起就可以了。

【讨论】:

  • 我已经尝试过了,但它仍然会删除格式。有趣的是,其他格式样式()也可以正常工作。
  • 只是一个简短的更新:我为这个问题写了一个雷达。到目前为止,Apple 尚未对此做出回应。
猜你喜欢
  • 1970-01-01
  • 2012-02-19
  • 1970-01-01
  • 2011-01-06
  • 1970-01-01
  • 2010-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多