如何检测应用内MFMailComposeViewController何时消失?

时间:2011-11-26 13:23:13

标签: iphone objective-c ios email mfmailcomposeviewcontroller

我已经设置了一些代码来提取MFMailComposeViewController,以便应用程序的用户可以通过应用程序内的人员发送电子邮件。如何检测此视图控制器何时消失?

谢谢!

1 个答案:

答案 0 :(得分:0)

它可能对你有用。你可以知道他按下了哪个按钮。所以你可以知道邮件作曲家是否显示

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{   
    // Notifies users about errors associated with the interface
    switch (result)
    {
        case MFMailComposeResultCancelled:
            //NSLog(@"Result: canceled");
            break;
        case MFMailComposeResultSaved:
            //NSLog(@"Result: saved");
            break;
        case MFMailComposeResultSent:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" message:@"Mail Sent Successfully" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        }
            break;
        case MFMailComposeResultFailed:
            //NSLog(@"Result: failed");
            break;
        default:
            //NSLog(@"Result: not sent");
            break;
    }
    [self dismissModalViewControllerAnimated:YES];
}