I have ran into an interesting situation, I have an iPhone app with 3 UITableViewController
s each displaying more or less the same data (you can say it's a matter of filtering). To date I had 3 separate NIBs for this, each with it's own controller, additionally the UITableViewController
s were inside UINavigationController
for the sake of buttons on top.
Now to optimize the app and reduce it's footprint, I pack all the logic to one common controller (an UITableViewController
) and left only one NIB in place. The common controller would take care of filtering the data out, and pointing to the correct data.
So, I load the same common controller to 3 of the navigation controllers:
navControllerA = [[UINavigationController alloc] initWithRootViewController: commonTableController];
and added these navigation controllers to the UITabBarController
:
navigationControllersArray = [NSArray arrayWithObjects: navControllerA, navControllerB, navControllerC, nil];
[tabController setViewControllers:[NSArray arrayWithArray:navigationControllersArray]];
Now all is fine, the tabs display, the table views show up. But once you touch the next UITabBarItem
and go back to the previous one the UITableViewController
doesn't show, you can only see a UIWindow
in it's place. The UITableViewController
stays visible only for the last touched UITabBarItem
.
Is there some kind of UITabBar
view loading mechanism I'm not aware of?