从视图中删除modalViewController?

And*_*rew 2 iphone objective-c modalviewcontroller

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

secondView = [[SecondView alloc] init];

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

[self presentModalViewController:navigationController animated:YES];
[navigationController release];
Run Code Online (Sandbox Code Playgroud)

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

[self.navigationController.modalViewController dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)

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

Jor*_*ans 9

尝试:

[self.navigationController dismissModalViewControllerAnimated:YES]
Run Code Online (Sandbox Code Playgroud)