I'm curious if there is a legitimate API with which you can get view controllers that are children of a UIMoreListController
? (The UIMoreListController is the child at the top of the view stack of the UIMoreNavigationController. UIMoreNavigationController is the object that the moreNavigationController
property of the UITabBarController
.)
In other words, if I have a UITabBarController and I installed an array of six view controllers on it, the view hierarchy will actually look like this (it is actually a view hierarchy, not view controllers, but using these identifiers makes more sense):
+ UITabBarController <-- has five tabs |--- view controller <-- these are my own view controllers |--- view controller |--- view controller |--- view controller |--+ UIMoreNavigationController <-- root view controller of fifth tab |--+ UIMoreListController <-- table-based view shown on fifth tab |--- view controller <-- these are my own view controllers |--- view controller
One way to do this is to simply get the view controllers from the UITabBarController viewControllers viewControllers
, check if there are more than 5, and return all view controllers from index 5 to N - 1
, if there are more than 5. (If there are less than 5, then there are no controllers views will not be children of a UIMoreNavigationController.)
However, I would like to avoid hard-coding any assumptions about the number of view controllers that the UITabBarController will display before listing the remaining controllers in moreNavigationController
. Apple may change this number in the future. But I canβt find the API on either the UITabBarController or the UINavigationController with which to access these children, and the UIMoreNavigationController is not an open class, so I cannot rely on any methods open in this class.
source share