MFMailComposeViewController:取消不会退出到我的应用程序吗? [英] MFMailComposeViewController : cancel doesn't exit to my app?

查看:55
本文介绍了MFMailComposeViewController:取消不会退出到我的应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MFMailComposeViewController发送邮件.当我单击应用程序上的按钮时,就会发生这种情况.当然,当我单击邮件控制器的取消"按钮时,我想返回到我的应用程序视图,但是它不起作用.该怎么办 ?这是我的代码:

I'm trying to send a mail with MFMailComposeViewController. It happens when I click a button on my app. Of course when I click the Cancel button of the mail controller I want to go back to my app view but it doesn't work. What to do ? Here is my code :

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Subject"];
[controller setMessageBody:@"<html>Test</html>" isHTML:YES];
[controller setToRecipients:nil];
if(controller) [self presentModalViewController:controller animated:YES];

感谢您的建议

推荐答案

您实现了此委托方法吗?在用户退出作曲者之后调用它.

Have you implemented this delegate method? It's called after the composer is exited by the user.

- (void)mailComposeController:(MFMailComposeViewController*)controller 
      didFinishWithResult:(MFMailComposeResult)result
                    error:(NSError*)error 
{ 
    [self dismissViewControllerAnimated:YES completion:nil];
    return;
}

这篇关于MFMailComposeViewController:取消不会退出到我的应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆