image into mail body in iphone
how to insert uiimage into body of mail composer window.. i have with this code:
NSMutableString *emailBody = [[[NSMutableString allocinitWithString:@""] retain]; [emailBody appendString:@"type text here
"]; UIImage *emailImage =开发者_如何学Go [UIImage imageNamed:@"20-gear2.png"]; NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(emailImage)]; NSString *base64String = [imageData base64EncodedString]; [emailBody appendString:[NSString stringWithFormat:@"",base64String]]; NSLog(@"emailBody....%@", emailBody); [emailBody appendString:@""]; NSLog(@"emailBody1....%@", emailBody);
MFMailComposeViewController *mailComposerController = [[MFMailComposeViewController alloc] init];
[mailComposerController setSubject:@"Your subject"];
[mailComposerController setMessageBody:nil isHTML:YES];
NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:"your image.png"]);
[mailComposerController addAttachmentData:imageData mimeType:@"image/png" fileName:@"image.png"];
Hope this help you...
NSData *imageData = UIImagePNGRepresentation(yourImage);
[mailController addAttachmentData:imageData mimeType:@"image/png" fileName:imageName];
精彩评论