MFMailComposer发送附加的图像大小增加
我使用MFMailComposer使用此代码发送image.m
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; if (picker !=nil) { picker.mailComposeDelegate = self; NSString *msgTitle; [picker setToRecipients:[NSArray arrayWithObjects:@"", nil]]; [picker setSubject:msgTitle]; [picker addAttachmentData:UIImagePNGRepresentation(imageView.image) mimeType:@"image/png" fileName:@"img"]; [self presentModalViewController:picker animated:YES];
如果我的图像大小为500kb,MFMailModalView中的图像大小显示为2MB。
图像是big.i发送图像只有在我的代码相同的大小。
NSData *UIImageJPEGRepresentation(UIImage *image, CGFloat compressionQuality)
//Replace this snippet to your code
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
if (picker !=nil) {
picker.mailComposeDelegate = self;
NSString *msgTitle;
[picker setToRecipients:[NSArray arrayWithObjects:@"", nil]];
[picker setSubject:msgTitle];
[picker addAttachmentData:UIImageJPEGRepresentation(imageView.image,0.5) mimeType:@"image/png" fileName:@"img"];
[self presentModalViewController:picker animated:YES];
该功能将帮助您压缩图像的大小。
链接地址: http://www.djcxy.com/p/84307.html上一篇: MFMailComposer sending attached image size increased
下一篇: Picture loaded from Camera Roll too stretched in portrait mode