UINavigationController inside a UITabBarController23 Jun
I was having a head-banging session last night trying to get a UINavigationController working within a UITabBarController. I reached out to peers from Big Nerd Ranch, and received a very succinct solution from Brian Slick:
—
I just yesterday rewired my program to use a XIB file in this way. The resulting structure looks like this:
Tab Bar Controller
…..Tab Bar
…..Navigation Controller
……….Navigation Bar
……….MyViewController1
……….Tab Bar Item
…..Navigation Controller
……….Navigation Bar
……….MyViewController2
……….Tab Bar Item
Just drag however many UINavigationControllers you need from the palette to the Tab Bar Controller. Crack open each one, and set the class of the View Controller inside to be your appropriate custom class.
—
Just follow along the XIB paths, and it works flawlessly. Awesome. (Also, don’t forget to set the various tabs to NavigationController at the root of the UITabBarController.)
Hah! I’ve been banging my head on this all day, and I was apparently trying to make it *way* too complicated. This worked great, thanks!