UIImage发送到电子邮件 [英] UIImage send to email

查看:174
本文介绍了UIImage发送到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的程序中,在运行时修改图像,我必须通过电子邮件发送。不需要保留在设备中。任何建议?

In my program modify an image at run time and I have to send it by e-mail. Not required to keep in the device. Any suggestions?

我使用这个但不起作用,因为图像不保存在mi iphone =(

I use this but not works because the image is not saved in mi iphone =(

- (void)emailImage{


    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    // Set the subject of email
    [picker setSubject:@"MI FOTO FINAL"];

    // Fill out the email body text
    NSString *emailBody = @"Foto final";

    // This is not an HTML formatted email
    [picker setMessageBody:emailBody isHTML:NO];


    NSData *data = UIImagePNGRepresentation(Foto.image);

    [picker addAttachmentData:data  mimeType:@"image/png" fileName:@"ImagenFinal"];

  //  [picker addAttachmentData:data mimeType:nil fileName:nil];


    // Show email view  
    [self presentModalViewController:picker animated:YES];

}

推荐答案

您可以使用 UIImagePNGRepresentation() 功能从您的 UIImage 中提取png格式的数据。

You can use the UIImagePNGRepresentation() function to extract a png-formatted data from your UIImage.

这篇关于UIImage发送到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆