Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- // This is to clean up from the colored bar in detail view
- self.navigationController.navigationBar.tintColor = nil;
- // These are to match the behaviour of Contacts app
- [self setEditing:NO animated:NO];
- // This is the tricky part: works when switching tabs, but not when back button was going to pop anyway!!
- [self.navigationController popToViewController:rootViewControllerForTab animated:NO];
- }
- @interface Pop2RootTabSwitchAppDelegate : NSObject
- <UIApplicationDelegate, UITabBarControllerDelegate> {
- UINavigationController *tab1NavController;
- }
- @property (nonatomic, retain) IBOutlet UINavigationController *tab1NavController;
- @end
- @implementation Pop2RootTabSwitchAppDelegate
- - (void)tabBarController:(UITabBarController *)tabBarController
- didSelectViewController:(UIViewController *)viewController {
- NSLog(@"[%@ tabBarController:%@ didSelectViewController:%@]", [self class],
- tabBarController, viewController);
- if (viewController == tab1NavController) {
- NSLog(@"viewController == tab1NavController");
- [tab1NavController popToRootViewControllerAnimated:NO];
- }
- }
Add Comment
Please, Sign In to add comment