如何在 ios 中将 web 视图数据和图像视图数据添加到 Mfmailcomposer 视图控制器。用于向他人发送邮件。
问问题
795 次
4 回答
2
您可以使用电子邮件创建一个图像完整路径数组您想要的 attech 并执行如下操作:-
- (IBAction)sendemail
{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
// We must always check whether the current device is configured for sending emails
if ([mailClass canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Hello"];
//NSString *result = txtFiled.text;
for(NSString *dicsss in buttonss) // Hear buttonss its a ImagePathfull array
{
UIImage *imgvith = [UIImage imageWithContentsOfFile:[buttonss stringByAppendingPathComponent:dicsss]];
NSData *data = UIImagePNGRepresentation(imgvith);
[picker addAttachmentData:data mimeType:@"image/png" fileName:@"yourImagename"];
}
NSString *emailBody = @"Hi";
[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
}
}
工作代码截图看起来像: -
于 2013-01-22T11:02:14.447 回答
0
您可以使用
for (UIImage *yourImage in YourImageArray )
{
NSData *imgData = UIImageJPEGRepresentation(yourImage, 0.5);
[mfMailComposer addAttachmentData:imgData mimeType:@"image/jpeg" fileName:[NSString
stringWithFormat:@"a.jpg"]];
}
于 2013-01-22T10:58:24.447 回答
0
最好的解决方案是
[mailCompose setMessageBody: msg isHTML: YES];
其中味精具有价值:
<body>
<img src='http://your_site/image1.jpg'>
<img src='http://your_site/image2.jpg'>
<br/>
<font face='Arial' size='2'>
Message Text<br/>
<br/>
</font>
于 2013-01-22T11:00:52.637 回答
0
您可以在邮件编写器实例中添加多个图像。但请确保文件名不同。在这里查看:http: //developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html#//apple_ref/doc/uid/TP40008200-CH1-SW2。
于 2013-01-22T11:02:08.550 回答