3

在按键回调中:

 MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
    mailViewController.mailComposeDelegate = self;

    [self presentModalViewController:mailViewController animated:YES];

委托实施:

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
NSLog (@" Inside  MAIL COMPOSER CONTROLLER DELIGATE ");


// Remove the mail view
[self dismissModalViewControllerAnimated:YES];
}

当我在 MailComposerView 中按下取消按钮时,不会调用删除。我究竟做错了什么 ?

4

2 回答 2

1
  1. 将您的 viewController 设置为 MFMailComposeViewControllerDelegate:

    @interface CurrentViewController : UIViewController <MFMailComposeViewControllerDelegate>
    
  2. 在实例化后立即设置您的 mailComposer 委托:

    MFMailComposeViewController * mailComposer = [[MFMailComposeViewController alloc]init];
    mailComposer.mailComposeDelegate = self;
    
于 2013-03-21T00:23:09.383 回答
0

你真的让你的班级成为 MFMailComposeViewControllerDelegate 吗?

@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>
于 2012-05-18T21:20:17.247 回答