gpt4 book ai didi

iphone - 如何将两个图像附加到 ios 中的 mfmailcomposer View Controller

转载 作者:行者123 更新时间:2023-11-28 22:41:18 24 4
gpt4 key购买 nike

如何将网页 View 数据和 ImageView 数据添加到 ios 中的 Mfmailcomposer View Controller 。用于向其他人发送邮件。

最佳答案

你可以先创建一个图像完整路径数组,然后用电子邮件发送你想要的内容,然后像下面那样做:-

- (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];
}


}

工作代码截图看起来像:-

enter image description here

关于iphone - 如何将两个图像附加到 ios 中的 mfmailcomposer View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14456838/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com