I have set up a delegate for my UITabBarController and have the following delegate method:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
[self.navigationController popToRootViewControllerAnimated: YES];
return NO;
}
The method fires and in the context, I'm one or two levels into table views. The root view controller gets displayed correctly, but the navigation bar doesn't get reset, and still has a "back" button from one or two levels into the table views.
(The above delegate method is a simplified form of what I'm trying to do in my app, but still exhibits the problem. In my app, I need the root view displayed when I return to the original tab, so am trying to pop to the root view before I leave).
popToRootViewControllerAnimated not working correctly suggests a time lag issue, but that doesn't appear to be what's going on in my case. I can wait as long as I want before doing the shouldSelectViewController and the nav bar "back" button still is messed up.
The delegate is:
@interface BasicPlaceItemComment : UIViewController<UIAlertViewDelegate, UITabBarControllerDelegate> {
// data members ommitted
}
This is the class from which I derive all of my table views.