我有一个 navigationController,从中启动 ModalViewController。
在此 ModalViewController 中,我将显示 MailComposer,它本身是另一个 ModalViewController。
现在,如果用户点击发送按钮,MailComposerView 以及其他模态视图控制器都应该被关闭。为此,我在 mailComposer 控制器中调用委托方法。
现在只有 MailComposerView 将被解雇,但其他 ModalViewController 不会被解雇,我收到以下错误消息
attempt to dismiss modal view controller whose view does not currently appear. self = <UINavigationController: 0x724d500> modalViewController = <UINavigationController: 0x72701f0>
你有什么想法我会做错吗?
第一个模态视图
- (void)addList {
NSLog(@"addList");
//AddListViewController *addListViewController = [[AddListViewController alloc] init];
AddListViewController *addListViewController = [[AddListViewController alloc] initWithStyle:UITableViewStyleGrouped];
addListViewController.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addListViewController];
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = YES;
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
[addListViewController release]; }
在AddListViewController中调用MailView
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
mailComposer.mailComposeDelegate = self;
NSString *subject = [NSString stringWithFormat:@"Group invite for groupname: %@", @"mhm"];
[mailComposer setSubject:subject];
// Fill out the email body text
NSString *emailBody = @"This is an group invite bla bla";
[mailComposer setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailComposer animated:YES];
[mailComposer release];
在 mailComposerController 方法中
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.delegate finishAddList:checkmark andListName:listName.text];
在 finsihAddList 委托中
[self dismissModalViewControllerAnimated:YES];