在使用MFMailComposeViewController类时,有没有办法检查用户是否实际按下了发送按钮?
由于
答案 0 :(得分:1)
使用MFMailComposeViewControllerDelegate(https://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMailComposeViewControllerDelegate_protocol/Reference/Reference.html)
-(void)sendMail
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
[mailer setMailComposeDelegate:self];
//do the rest of the mail composing
...
}
-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
//don't forget to dismiss the controller
[controller dismissModalViewControllerAnimated:YES];
if(result == MFMailComposeResultSent)
{
//the user sent the mail
}
}