Issues with UIMoreNavigationController and UITabBarController

感情迁移 提交于 2019-12-06 09:56:00

Actually the moreViewController of the Tabbar IS a UIMoreNavigationController. (You can have a look at the private header on GitHub)

As the documentation states, the viewController property only contains the viewControllers, which you have added to the tabbar: You must also not look for the More navigation controller in the array of view controllers stored in the viewControllers property. The tab bar controller does not include the More navigation controller in that array of objects.

See documentation here: UITabbarViewController.

Anyway i don't understand, what your problem exactly is. If you need to access the UIMoreNavigationController do it via the moreNavigationController property of the UITabBarViewController.

But the 'viewControllers' property always only holds those ViewControllers, that you have added to the TabBar.

Since you don't say what your actual problem is, I can't say anything about that. But I'm quite sure that there is no such class as UIMoreNavigationController. The "More" navigation controller is just a UINavigationController managed by UITabBarController to hold any surplus child controllers. See Apple's UITabBarController reference, but you can also double-check in the UIKit framework header file UITabBarController.h.

Correspondingly, I was unable to reproduce your debug output where you show <UIMoreNavigationController: 0x826ab00>. In my environment (SDK 5.0), I just get <UINavigationController: 0x12345678>, regardless of whether I check my custom view controller's parent, or the tab bar controller's children.

Just to confirm a have the same problem. I believe that using setViewController: is broken in situations a UIMoreNavigationController has been created by the UITabBarController. The issue is that when changing the tab bar's view controllers, the more navigation controller is not correctly maintained - the controller hierarchy is getting corrupted. I have filed a bug with Apple but have not yet received a reply.

  • Harald
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!