我在这里得到了一个非常有趣的问题。我的iPhone应用程序在AppDelegate中有一个UITabbarController作为rootViewController。UITabbarController关闭模式UINavigationController
如果应用程序第一次打开,它必须基本配置。为了这个目的,我创建的UINavigationController,并告诉tabbarController到模态呈现它:
firstRun = [[firstRunViewController alloc] init];
navCtrl = [[UINavigationController alloc] initWithRootViewController:firstRun];
[[self tabBarController] presentModalViewController:navCtrl animated:NO];
当配置完成后,我想摆脱firstRunViewController的。我经常使用这种技术,使用-dismissModalViewControllerAnimated:
。
但在这个星座这不起作用。从我称之为解雇的控制者来看,这并不重要。 我试图通过tabbarController,rootViewController,当前活动viewController,导致self和其他几个控制器。
我每次打电话-dismissModalViewControllerAnimated:
我得到这个异常:
'UIViewControllerHierarchyInconsistency', reason: 'presentedViewController for controller is itself on dismiss for: <UINavigationController:…
有人能帮忙吗?由于提前,以亲切的问候,朱利安
编辑 在我的AppDelegate我使用的UITabBarController作为RootViewController的主窗口:
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
然后我创建的UINavigationController,告诉的UITabBarController呈现modalViewController:
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:firstRun];
[[self tabBarController] presentModalViewController:navCtrl animated:NO];
当我现在请-dismissModalViewControllerAnimated:在firstViewController我得到错误FR om以上。
这类作品...但我不能应用动画。我试图在最后一个模式viewController上添加[UIView animateWithDuratio:]。但动画只是不显示。 –
我真的很想了解问题所在。因为我提出了一个modalViewController(日常业务),就像我一样,当我提出我的login-viewController时。我认为问题是更多的一个实例,导航控制器... –