gpt4 book ai didi

iphone - 如何在 Mail Composer 中附加图像?

转载 作者:行者123 更新时间:2023-12-03 20:18:19 26 4
gpt4 key购买 nike

我想使用 Mail Composer,它还应该附加图像文件,这怎么可能?

最佳答案

您可以测试此代码,它运行良好...

MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];

mailController.mailComposeDelegate = self;

[mailController setSubject:@"Hello iPhone"];

[mailController setMessageBody:@"This is the MailSend Application...." isHTML:NO];

UIImage *pic = [UIImage imageNamed:@"Image box with border-1.png"];
NSData *exportData = UIImageJPEGRepresentation(pic ,1.0);
[mailController addAttachmentData:exportData mimeType:@"image/jpeg" fileName:@"Picture.jpeg"];


[self presentModalViewController:mailController animated:YES];
[mailController release];
}

- (void)mailComposeController:(MFMailComposeViewController*)mailController

didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error

{

[self becomeFirstResponder];

[self dismissModalViewControllerAnimated:YES];

}

有关示例代码的更多信息请在此处查看

http://iosrider.wordpress.com/2012/01/06/how-to-add-email-and-message-in-your-native-application/

关于iphone - 如何在 Mail Composer 中附加图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3270633/

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