Resets the stacks view when the root controller is a tab bar controller
-
20-09-2019 - |
Question
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,
Solution 2
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
OTHER TIPS
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.