PDA

View Full Version : The right way for NavControllers in TabBars




mraheel
Dec 8, 2009, 06:10 AM
this is a "whats the right way and does it make a difference question"!

I've been watching some tutorials right from the very basic things. one of them is about the famous tabbar, navbar, table tutorial.

I already have similar app in submission right now. But in creating a new app. I thought id follow what theyre saying.

The difference is that in that tutorial, the person creates a NavigationController subclass and adds it to the appdelegate.
Obviously theres a NavController in one tab of the tabcontroller.

What i usually do simply create a basic viewController. and I add NavigationController IN THAT viewController and connect it in the interface builder.

i dont add it in the appdelegate.

One reason is that i've got 4 tabs that use navigationcontroller. If i went along the tutorial method, i'd hav to create NavigationControllerClasses for each of them add them all to appdelegate. Plus thats more 4 additional files.

Other reason, its just tiring!

If i need to call that a navcontroller method in a specific tab from the appdelegate. i simply do :

[[self.rootTabBarController.viewControllers objectAtIndex:2] pushViewController:detailViewController animated:YES];

There are no problems what so ever, So, my question is, is there anything wrong with what I'm doing.. and What might be the advantages of creating a NavController class if at all they are.