【发布时间】:2012-01-30 12:18:27
【问题描述】:
我正在尝试获取我选择发送电子邮件的电子邮件。 但我不知道如何设置我在 MFMailComposeViewController 视图中选择的用户。
if ([MFMailComposeViewController canSendMail])
{
mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"A Message from blablabl"];
NSMutableArray *usersTo = [[NSMutableArray alloc] init];
toRecipients = usersTo;
[mailer setToRecipients:toRecipients];
NSString *emailBody = @"blablablabal";
[mailer setMessageBody:emailBody isHTML:YES];
// only for iPad
// mailer.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:mailer animated:YES];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failure"
message:@"Your device doesn't support the composer sheet"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
}
【问题讨论】:
标签: iphone objective-c xcode mfmailcomposeviewcontroller