在buttonpress回调中:
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中的取消按钮时,不会调用删除。我做错了什么?
答案 0 :(得分:1)
将viewController设置为MFMailComposeViewControllerDelegate:
@interface CurrentViewController : UIViewController <MFMailComposeViewControllerDelegate>
在实例化后立即设置mailComposer委托:
MFMailComposeViewController * mailComposer = [[MFMailComposeViewController alloc]init];
mailComposer.mailComposeDelegate = self;
答案 1 :(得分:0)
你真的让你的班级成为MFMailComposeViewControllerDelegate吗?
@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>