简体   繁体   English

如何将UIImage插入具有html内容的电子邮件中?

[英]How to insert a UIImage into an e-mail with html content?

I'm sending mails thanks to the MFMailComposeViewController API, and I manage to add uiimages in attachment, but I'd like to insert my uiimage into html code in my e-mail, any idea of what kind of conversion I should use for my image ? 我要感谢MFMailComposeViewController API发送邮件,并且设法在附件中添加uiimage,但是我想将uiimage插入电子邮件中的html代码中,无论我应该使用哪种转换方式图片 ?

Thanks. 谢谢。

First, convert the image into PNG ( UIImagePNGRepresentation ) or JPEG ( UIImageJPEGRepresentation ) data. 首先,将图像转换为PNG( UIImagePNGRepresentation )或JPEG( UIImageJPEGRepresentation )数据。

Then, call -addAttachmentData:mimeType:fileName: on the mail compose view controller with that PNG/JPEG data. 然后,使用该PNG / JPEG数据在邮件撰写视图控制器上调用-addAttachmentData:mimeType:fileName:

Your image will be shown as an attachment. 您的图片将显示为附件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM