【发布时间】:2012-08-15 08:02:59
【问题描述】:
我有包含一些 UINavigationControllers 的 UITabbarMoreController。这些 UINavigationControllers 然后包含我的自定义视图控制器。
所以层次结构看起来像这样:
UITabbarController
- UINavigationController
-> my custom UIViewController
- ...(other children of UITabbarController look the same)
在我的自定义视图控制器中,我调用 [self parentViewController],它应该返回一个 UINavigationController。这确实发生了,我确实得到了一个 UINavigationController,但只有当特定的 UINavigationController 不在 moreNavigationController 中时。
由于我在 tabbar 控制器中有很多子控制器,所以 tabbar 控制器创建了一个 moreNavigationController。如果我打开 moreNavigationController 下的视图控制器并调用 [self parentViewController] 它会返回一个带有 UIMoreNavigationController 类的神秘对象
我确实需要获取作为我的视图控制器的父级的 UINavigationController,而不是 UIMoreNavigationController。另外,我尝试使用 [self navigationController] 得到相同的结果。如何获得对我的视图控制器真正最近的父级的引用?提前感谢您的帮助!
【问题讨论】:
-
看看这个答案它有类似的问题stackoverflow.com/a/9567134/277021
-
我见过,但它并没有解决我的问题。我不需要访问 moreNavigationController。我需要访问我自己的 UINavigationController,它嵌套在 moreNavigationController 中。感谢您尝试提供帮助
标签: iphone ios uinavigationcontroller uitabbarcontroller parentviewcontroller