MFMailComposeViewController不关闭 [英] MFMailComposeViewController not dismissing
本文介绍了MFMailComposeViewController不关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码在didSelectRowAtIndexPath中调用。问题是,当我单击取消按钮,它提示保存草稿或丢弃。但是当我点击任一,视图不会关闭。我在前iOS5应用程序使用相同的代码,它驳回了罚款。有任何想法吗?我在接口中有MFMailComposeViewController委托协议。
I have the following code that gets called in didSelectRowAtIndexPath. The issue is, when I click the cancel button, it prompts for save draft or discard. But when I click either, the view does not dismiss. I've used the same code in a pre iOS 5 app and it dismissed fine. Any ideas? I have the MFMailComposeViewController delegate protocol in the interface.
if (indexPath.row == 0)
{
if([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Support"];
NSArray *toRecipients = [NSArray arrayWithObject:@"contact@app.com"];
[picker setToRecipients:toRecipients];
NSString *emailBody = text;
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
}
}
推荐答案
strong>使用:
Use:
dismissViewControllerAnimated:completion:
从IOS 6.0 DEPRECATED:
将此方法添加到您的课程: / p>
Add this method to your class:
-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissModalViewControllerAnimated:YES];
}
有趣
这篇关于MFMailComposeViewController不关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文