在App Email View中没有关闭 - iPhone OS 4

时间:2011-05-30 17:53:30

标签: iphone mfmailcomposeviewcontroller

我很难添加用户向我自己(该应用程序的制造商)发送支持电子邮件的能力。我已经让它工作得非常完美但是当您单击取消或单击发送时视图不会关闭。谢谢你的帮助!

以下是代码:

 MFMailComposeViewController *mail = [[[MFMailComposeViewController alloc] init] autorelease];


        mail.mailComposeDelegate = self;

        [mail setToRecipients:[NSArray arrayWithObject:@"support@lindahlstudios.com"]];
        [mail setSubject:@"Fraction Calculator Lite Support"];    

        [self presentModalViewController:mail animated:YES];

2 个答案:

答案 0 :(得分:3)

您将self设置为MFMailComposeViewController的委托。在mailComposeController中:didFinishWithResult:错误:请务必调用

[self dismissModalViewControllerAnimated:YES];
像这样:

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

答案 1 :(得分:0)

您需要从MFMailComposeViewControllerDelegate实现委托方法。

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