我有一个导航控制器,从那里我启动一个MODALVIEW控制器。
在这个MODALVIEW控制器中,我将显示MayCalpor,它本身是另一个MODALVIEW控制器。
现在,如果用户点击发送按钮,MeMyTyrVIEW应该被删除,同时另一个MODALVIEW控制器也会被删除。为此,我在MealPrimeRealCube中调用委托方法。
现在,只有MyTypReVIEW将被删除,但没有其他MODALVIEW控制器,而我得到以下错误消息

attempt to dismiss modal view controller whose view does not currently appear. self = <UINavigationController: 0x724d500> modalViewController = <UINavigationController: 0x72701f0>

你知道我会做错什么吗?
第一个modalview
- (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];    }

在AdvistVIEW控制器中调用邮件视图
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];

在邮件合成控制器中
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.delegate finishAddList:checkmark andListName:listName.text];

在finsihaddlist委托中
[self dismissModalViewControllerAnimated:YES];

最佳答案

您必须延迟调用第二个解除,因为调用时第一个解除尚未完成。

[self performSelector: @selector(finish:) withObject: obj afterDelay: 0.0f];

延迟0.0f是故意的,这意味着它将在下一个事件循环中完成。

09-25 16:47