0
votes

I have a tab bar controller and in both tab bar items i have a nav controller in each. I would like that whenever a user goes away and back to a tab bar item it resets the nav controller.

If I've been navigating in one of the tab bar and then i press another tab item and go back it takes me to the beginning of the navigation.

Any ideas?

Thanks,

2

2 Answers

3
votes

Set yourself to be the delegate of the tabBarController, and whenever you get a -tabBarController:shouldSelectViewController: message, call -popToRootViewController on your tab's navigation controller.

1
votes

Here is what it works for me...

I made the appDelegate a UITableBarViewControllerDelegate too.

@interface InterfacesAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {

After, In IB I connected the tabbarcontrollerDelegate to the appDelegate. In this case Interfaces App Delegate

As Ben said, I then implemented the abBarController:shouldSelectViewController under InterfacesAppDelegate.m