UINavigationController setViewController:animated: navigation bar difficulties
I faced the same problem, it seems that Apple haven't corrected that bug and as a result the selected answer of this thread appears to be incorrect. I managed to correct this problem using this bug report as in the comment of Anurag combined with the comment of Scott Pfeil.
Here is the code :
navController.navigationBarHidden = YES;
NSArray* viewControllers = navController.viewControllers;
UIViewController* currentController = [viewControllers objectAtIndex:viewControllers.count-1];
NSArray *controllers = [NSArray arrayWithObjects: viewController , currentController , nil];
[navController setViewControllers:controllers animated:NO];
navController.navigationBarHidden = NO;
I call this code in the viewDidLoad of the currentController
and what I did is replace the previous controllers with only viewController
.
Hope this helps.
Apple appears to have fixed this in the newest SDK