UITabBarController and multiple instances of UITableViewController
Here comes another post from the series “note to self”…
Imagine you have a UITabBarController and you wish to have two very similar UITableViewControllers nested within (as different tab items). If the difference between the two TVCs is simply a matter of configuration (e.g. datasource) then you should simply point Interface Builder to the same class. You need not worry, different instances of your TVC will be created for you.
This comes in handy especially when you use different tab items just because your data is organized differently on each of the tabs.
I just thought I’d share this with you since I *hate* seeing duplicate code!
Cheers…
p.s. the more I master the dynamic UI generation the more comfortable I am using the IB. Isn’t this a bit ironic and paradoxical?!
Tags: iPhone
By Nick | 6. May 2009 | Objective C, Tutorial, iPhone | 1 Comment »
Due to your requests I think I will follow up on this post soon with an actual example on how to mix the UITabBarController with a UINavigationController that handles table views…