MFMailComposeViewController几个附件

时间:2013-02-04 19:52:41

标签: ios objective-c xcode email-attachments mfmailcomposeviewcontroller

我已成功从我的应用发送附有UIImage的电子邮件,但是是否可以使用MFMailComposeViewController附加多个图片?

2 个答案:

答案 0 :(得分:5)

您可以将所有图像保存在NSMutablearray中并运行代码

[mailer addAttachmentData:imageData mimeType:@"image/png" fileName:@""];

了解NSMutableArray的计数。它会将图像添加到附件字段

  for (int i = 0; i < [_textField0.emojiArray count]; i++)         
 {
    emoji = [_textField0.emojiArray objectAtIndex:i];
  UIImage *image = [EmojiResizer resizeImage2:[UIImage imageNamed:emoji.screenfilename]
   imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];

 [mailViewController addAttachmentData:imageData mimeType:@"image/png" fileName:emoji.filename];         
}

做这样的事情。

答案 1 :(得分:2)

为您要添加的每个附件调用addAttachment...