Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rendezvouscp

macrumors 68000
Original poster
Aug 20, 2003
1,526
0
Long Beach, California
Hey,

Like most apps, the app that I’m building requires the use of a UITabBarController and UINavigationControllers together. This theoretically is pretty simple; I’ve read the docs, I understand that the UITabBarController holds the collection of UINavigationControllers, and each UINavigationController holds the UIViewControllers necessary to display views.

In short, my current design looks like so:
-File’s Owner
-First Responder
-App Delegate
-Window
-Tab Bar Controller
-Tab Bar​
-First Navigation Controller​
-Navigation Bar​
-View Controller​
-Table View​
-Navigation Item​
-Tab Bar Item​

Where I’m getting confused is when I try to move from a one-nib design to a multi-nib design. I *believe* that a better design would be to have a UITabBarController in a MainWindow.nib and have that nib load other nibs with the UINavigationControllers as needed.

So, I create my new nibs, create navigation controllers in the new nibs, tell my UITabBarController Tab Bar Item to look for the nib, and find my app useless. I don’t know what I’m doing incorrectly in my move from one nib to multiple nibs.

I’d appreciate any advice or help or guidance that anyone can provide. Thanks in advance.
 
Do you have your nibs properly using the File Owner? Are all IBOutlets hooked up? Remember to use the debugger.
 
Did you finally found a solution for this? Because I'm trying to perform the same thing, and I can't get it to work. I would be very interested to get hints to achieve this UITabBarController + UINavigationController architecture using multiple NIBs.
 
Generally, you'd put the tabbar in the mainview along with the navigationcontrollers.

Then you'd link the viewcontroller from each of the navigationcontrollers in separate files each.

For your situation, the reason why it's not working is that you'd have to subclass the navigationcontrollers for it to work...and generally, it's not recommended to subclass the navigationcontrollers
 
When reading this, I understood it as removing the "NIB Name" property from the view of a given tab bar item, then creating a NavigationController, who's "NIB Name" is the secondary nib/xib file for the root of the navigation controller.

If that is correct, how do you cause the NavController to be linked to the subview generated for a given TabBar entry in IB? Or is this something that must be done in code?

==EDIT==

Didn't realize that each button on the tab bar *is* a viewcontroller, switched one to a navcontroller, pushed the view on at load time and problem solved.
 
Generally, you'd put the tabbar in the mainview along with the navigationcontrollers.

Then you'd link the viewcontroller from each of the navigationcontrollers in separate files each.

For your situation, the reason why it's not working is that you'd have to subclass the navigationcontrollers for it to work...and generally, it's not recommended to subclass the navigationcontrollers

OMG Thanks. I spent 2 days trying to figure out how to do this. The key is the navigationcontroller is in the tabbarcontroller nib.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.