UIImageView.Image 使用 MonoTouch 发送邮件附件
我是 MonoTouch 新手,我正在尝试发送一封电子邮件,其中包含图像作为附件,用户将从相机中驯服或从图库中选择该图像。
我已经创建了程序并且它运行正确(我有一个 imageview 控制器,它将图像从 uiimagepicker 加载到 imageview。然后我调用 MFMailComposeViewController ,但我不知道如何将图像从 imageview 传递到 < 我想首先我必须将 imageview 中的图像保存为文件,但我不知道该怎么做,
也找不到它的文档。
I am new to MonoTouch and I am trying to send an email with an image as attachment that a user will tame from camera or pick from gallery.
I have created the program and it runs correctly (I have an imageview controller which loads an image from uiimagepicker to imageview. Then I call MFMailComposeViewController
but I don't know how to pass the image from imageview to addAttachmentdata
method.
I suppose first I have to save the image from imageview as a file but I don't know how to do it and I can't find documentation for it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要将
UIImage
转换为NSData
,例如使用AsPNG
或AsJPG
,然后使用右侧的 <图像的strong>MIME类型。下面是一个示例:注意:
“image.png”
是一个建议的 提供给收件人电子邮件软件的文件名(即它不是您设备中的本地文件,并且不需要与现有的任何文件匹配)。First you need to turn the
UIImage
into anNSData
, e.g. usingAsPNG
orAsJPG
, then use the right MIME type for the image. Here's an example:Note: the
"image.png"
is a suggested file name given to the recipient email software (i.e. it's not a local file in your device and does not need to match anything that exists).