【发布时间】:2012-10-19 03:26:57
【问题描述】:
我有一个 iPhone 应用程序,它从 App 内置的相册中挑选照片。现在我想添加一个分享按钮,可以选择通过电子邮件分享这张照片,我可以通过这个代码附加一张现有的照片:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@""];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@""];
[picker setToRecipients:toRecipients];
// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"project existing photo" ofType:@"jpg"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"photo name"];
// Fill out the email body text
NSString *emailBody = @"";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
但是我需要在此代码中进行哪些更改才能将选择的相册附加到电子邮件正文中? 提前致谢。
【问题讨论】:
-
“将挑选的相册附加到邮件正文中”是什么意思?
-
我有一个按钮,用户可以从我需要的照片应用程序中选择一张照片,以便用户能够将该照片附加到电子邮件正文中。
标签: iphone ios xcode email-attachments file-sharing