开发者

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜