【发布时间】:2012-07-19 20:47:39
【问题描述】:
我有一个成功发送电子邮件的邮件控制器。
但我想在发送电子邮件时显示“电子邮件发送成功”的通知。有没有办法做到这一点?
谢谢。
【问题讨论】:
-
你用的是什么邮件控制器?
标签: iphone objective-c ios xcode ipad
我有一个成功发送电子邮件的邮件控制器。
但我想在发送电子邮件时显示“电子邮件发送成功”的通知。有没有办法做到这一点?
谢谢。
【问题讨论】:
标签: iphone objective-c ios xcode ipad
如果你使用MFMailComposeViewController,你可以使用它的委托方法。
1.设置代理:mailController.mailComposeDelegate=self;
2.然后使用委托方法`
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
if(result == MFMailComposeResultSent)
{
UIAlertView*sentalert=[[UIAlertView alloc] initWithTitle:@"Mail Sent succesfully!" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[sentalert show];
[sentalert release]; // if not using ARC
}
[self dismissModalViewControllerAnimated:YES]; //Dismiss your mail controller
}
【讨论】:
ARC:D,你会加起来的。