我正在展示来自另一个模态视图控制器的模态视图控制器,这在 iOS6 之前的所有 iOS 版本下都运行良好。但在 iOS6 下,我在模拟器中收到以下警告消息:
Warning: Attempt to present <UINavigationController: 0x14e93680> on <UINavigationController: 0x9fc6b70> while a presentation is in progress!
如果出现此警告,则不会显示模态视图控制器。基本上我使用这样的代码来显示模态视图控制器:
WebAuthViewController *authController = [[WebAuthViewController alloc] initWithNibName:nil bundle:nil];
authController.challenge = challenge;
authController.delegate = self;
UINavigationController *aNavController = [[UINavigationController alloc] initWithRootViewController:authController];
[self presentModalViewController:aNavController animated:YES];
[aNavController release];
[authController release];
已经显示的视图是 UIWebView 也显示在模态视图中,如下所示:
WebViewController *addController = [[WebViewController alloc] initWithNibName:nil bundle:nil];
addController.urlToLoad = [NSURL URLWithString:urlString];
addController.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addController];
navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
[addController release];
苹果文档仍然建议应该能够像这样堆叠导航控制器,所以我不知道为什么会发生这种情况。有什么提示吗?