If have a Navigation Bar and a Tab Bar in one of my views. This is all working fine. One of the Tab Bar items requires pushing several other view controllers on the navigation stack before I get the where I need to be. This is also working. When I click on the tab bar item, it marches right back up the stack. How can I make the desired controller stick in the tab bar item?
+1
A:
This is a standard behaviour of the Tab Bar, if you set it up with each tab pointing to a different view controller in the main nib file. It is in fact quite useful, allowing the user to navigate deeply within a particular stack, and then press the tab button that's already selected to return to the home/top level.
Note that this behaviour only happens when you click on a tab that you already have selected. You could implement a line in the tab bar delegate that intercepts the click on a tab and disregards it if that tab is already selected.
To do this you'll need to handle the display of different view controllers manually. You want to implement this method:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
and then push different views onto the navigation stacks yourself.
h4xxr
2010-03-21 23:05:35
Thanks for the help.You cannot change the appdelegate for the tab when in a NavigationController. I was able to do the same thing by overriding-(BOOL)tabBarController:(UITabBarController *)tbController shouldSelectViewController:(UIViewController *)vwController
Jim B
2010-03-22 16:17:15