我正在使用IOS5故事板。我的视图控制器路径如下:
tabbarVC --> navigationVC-1 --> tableVC-1 --(via segue push)-> tableVC-2 --(via segue modal)-> navigationVC-2 --> tableVC-3
在tableVC-3中的取消按钮回调方法中,我调用
[self dismissViewControllerAnimated:YES completion:nil];
成功返回到了tableVC-2。但是,当我尝试在调试器中向后检查导航路径时,我没有看到从navigationVC-2访问tableVC-2的方法。我期望navigationVC-2保持与tableVC-2或navigationVC-1的链接,但似乎并没有。请参见下面我的调试器输出。有人能解释一下导航层次结构以及如何以编程方式遍历链吗?
(gdb) po self
<tableVC-3: 0x6d33340>
(gdb) po (UIViewController*) [self navigationController]
<UINavigationController: 0x6d33560>
(gdb) po (UIViewController*)[[self navigationController] navigationController]
Can't print the description of a NIL object.
(gdb) po (UIViewController*)[[self navigationController] topViewController]
<tableVC-3: 0x6d33340>
(gdb) po (UIViewController*)[[self navigationController] presentingViewController]
<UITabBarController: 0x6b2eba0>
(gdb) po (UIViewController*)[[self navigationController] presentedViewController]
Can't print the description of a NIL object.
(gdb) po (UIViewController*)[[self navigationController] visibleViewController]
<tableVC-3: 0x6d33340>
[self.navigationController.navigationController popToRootViewControllerAnimated:YES];
。结构是这样的:导航控制器->表视图->(通过推送segue)->导航控制器->视图控制器。这对我起作用了!此外,它让我深入了解了事物的运作方式。 - joker