views:

54

answers:

1

Let's say I have a Tab Bar Controller with a tab A. A has a navigation controller, which lets me push new views onto the stack. Right now, if I tap A on the Tab Bar, all of the elements in A's stack will pop.

Is there a nice way to disable this? I have a sequence of views that are displayed with the navigation controller that takes user input would not like all of that to be lost with a slip of the finger.

Thanks in advance, and please let me know if my question is unclear.

+2  A: 

Try setting up a delegate for your UITabBarController, and implement:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

If the same view controller is being selected, return NO. Then the navigation stack should not change.

Note it will only be called for the same tab you are already on from iOS 3.0 on, but at this point I would only target iOS 3.0+.

Kendall Helmstetter Gelner
This worked perfectly! Thank you so much.
ayanonagon