Setting UITabBarController moreNavigationController

I am now setting up the More view in my UITabBarController application.

From what I see in the docs, there is little support for setting it up. There is only a read-only property of the UITabBarController, called "moreNavigationController", which points to the UINavigationController.

This allows us to at least customize the UINavigationBar. Customizing the table view presented in the first view is a bit more complicated.

On other issues here, in SO and elsewhere, I saw that all conversations revolve around involving the moreNavigationController in the internal structure (for example, by observing that the first view controller in the stack is a UITableViewController, replacing it with a data controller, etc.) . The problem is that all these methods make assumptions about how the undocumented code in the API behaves, assumptions that are unlikely to be in the future.

The only alternative I see here is to collapse my own custom “more controller” (optional to edit the editing functionality to make the implementation pretty simple) and use it as the fifth view controller on the tab. Of course, care must be taken to assign subsequent view controllers to a custom “more controller”, rather than directly to the UITabBarController (this rule may require subclassing the UITabBarController).

Which approach would you take? What other solutions would you suggest?

+6
objective-c iphone cocoa-touch uitabbarcontroller
source share
2 answers

I would choose a roll of my own controller for three reasons:

  • moreViewController managed by UIKit . Outwardly, it’s very difficult to set up some views and directly control them. moreViewController detects unpredictable methods and layer definitions. It cannot be the main UITableViewController . I think setting up classes that have delegates is more efficient.

  • If you configure moreViewController , you may have to release a new version of your application every time Apple releases a new iOS. Apple's moreViewController developers can change the whole class to something else. Thus, your application will stop responding.

  • My own class, my own home. I can do whatever I want.

+4
source share
 UIViewController *tbMore = ((UIViewController*) [self.moreNavigationController.viewControllers objectAtIndex:0]); int nRows = [((UITableView *)tbMore.view) numberOfRowsInSection:0]; for (int i = 0; i < nRows; i++) { UITableViewCell *c = [((UITableView *)tbMore.view) cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]]; // Do any additional customization here! } 
+4
source share

All Articles