从视图中删除modalViewController?

时间:2011-06-03 15:17:37

标签: iphone objective-c modalviewcontroller

我有一个视图,使用此代码拉入另一个视图:

secondView = [[SecondView alloc] init];

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:secondView];
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:navigationController animated:YES];
[navigationController release];

此第二个视图上的取消按钮具有:

[self.navigationController.modalViewController dismissModalViewControllerAnimated:YES];

但它似乎没有做任何事情。视图仍然存在,我仍然可以与它进行交互。我如何删除它?

1 个答案:

答案 0 :(得分:9)

尝试:

[self.navigationController dismissModalViewControllerAnimated:YES]