gpt4 book ai didi

iphone - 适用于 iOS 5 的 MFMailComposeViewController : Tutorial or Example

转载 作者:行者123 更新时间:2023-11-28 18:13:05 27 4
gpt4 key购买 nike

有没有人有关于如何以编程方式或使用 segues 为 ios 5 实现邮件编辑器的体面教程?我在网上找到的大部分教程都来自旧的 iOS 版本。谢谢!

最佳答案

你可以这样做:

if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
[mailController setMailComposeDelegate:self];
[mailController setSubject:@"Mail Subject!"];
[mailController setMessageBody:@"Here is your message body" isHTML:NO];
[mailController setToRecipients:[NSArray arrayWithObject:@"yourrecipent@domain.com"]];

NSData *imageData = UIImageJPEGRepresentation(imageToUpload, 1.0f);
if(imageData.length)
{
[mailController addAttachmentData:imageData mimeType:@"image/jpeg" fileName:@"Your_Photo.jpg"];
[self presentModalViewController:mailController animated:YES];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Image" message:@"The image couldn't be converted." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Okay", nil];
[alert show];
}
}
else NSLog(@"Hah. No mail for you.");

关于iphone - 适用于 iOS 5 的 MFMailComposeViewController : Tutorial or Example,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12394928/

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