如何将邮件添加到邮件中,然后添加到邮件视图中。如何添加UIImageView添加到邮件?
回答
如果使用的MFMailComposeViewController,则可以使用该视图控制器的这个方法:
addAttachmentData:mime类型:文件名:将指定的数据作为 附着到该消息。
- (无效)addAttachmentData:(NSData的*)附着mime类型:(的NSString *)mime类型文件名:(的NSString *)文件名
参数
- 附着
的数据到连接。通常,这是您要包含的 文件的内容。该参数不能为零。
- mime类型
MIME类型所指定的数据。 (例如,JPEG图像的MIME 类型为image/jpeg。)有关有效MIME类型的列表, 请参阅http://www.iana.org/assignments/media-types/。该参数必须为 不为零。
- 文件名
的优选的文件名与 数据相关联。这是应用于该文件的默认名称,当它被传送到目的地时,该文件为 。 中的任何路径分隔符(/)字符在传输之前会将文件名转换为下划线(_)字符。该参数不能为零。
讨论
此方法 消息体之后,但在 用户的签名之前附着指定的数据。您可以附加多个文件(使用不同的文件名称 ),但必须在显示邮件组成 界面之前进行。在向用户展示接口 之后不要调用此方法。
- (void)sendMailWithImage:(UIImage *)image
{
if([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
if(mailController!=nil) {
mailController.mailComposeDelegate = self;
NSData *imageData = UIImagePNGRepresentation(image);
[mailController addAttachmentData:imageData mimeType:@"image/png" fileName:@"MyImageName"];
[mailController setSubject:yourSubject];
[mailController setMessageBody:yourBody isHTML:NO];
[self presentModalViewController:mailController animated:YES];
[mailController release];
}
else
{
//Do something like show an alert
}
}
也看过本作更多的帮助
+1,它使用了我在上面的代码中我的回答 – Garoal
上建议的相同的方法,图像将被统计添加,在我的项目中将不得不动态地, –
- 1. 添加UIImageView到UIView
- 2. 如何添加透视到UIImageView
- 3. 如何将UIPanGestureRecognizer添加到UIImageView中
- 4. 如何将UIImageView添加到MKOverlayRenderer?
- 5. 将UIImageView添加到UIScrollView
- 6. 将UUD添加到UIImageView
- 7. 将UIImageView添加到UIScrollView
- 8. 将注释添加到UIImageView
- 9. 将UIImageView添加到UIScrollView
- 10. 将UIImageView添加到UITableViewCell?
- 11. 添加UITapRecognizerController到的UIImageView
- 12. UIImageView没有添加到UIView
- 13. 添加文本到UIImageView
- 14. 将UIImageView添加到UIButton
- 15. 将UILabel添加到UIImageView
- 16. PHP邮件添加';'到URL
- 17. 无法添加UIImageView?
- 18. 如何添加邮件附件箱
- 19. 如何添加懒惰的图像加载到UIimageview
- 20. 如何在UINavigationController的上面添加UIImageView
- 21. 如何在UIImageView中添加UILabel
- 22. 如何在CALayer上添加UIImageView?
- 23. 如何仅向UIImageView添加右边框
- 24. 如何在RTLabel中添加UIImageView?
- 25. iPhone:添加UIImage到UIImageView添加第二个图像
- 26. 如何以编程方式将UIImage添加到UIImageView然后将该UIImageView添加到另一个UIView?
- 27. 如何使用UIImageView附加邮件?
- 28. 将附件添加到电子邮件
- 29. 将附件添加到电子邮件
- 30. 将附件添加到PHP邮件
那么这是一个简短的问题,你能不能至少告诉我们你尝试过什么,我们看一些代码或错误... –