I am working on an iPad application for UINavigationController (simulator testing). There are only two UIViewControllers on the management controller stack. For a demonstration, call them SetupController and ContentController. SetupController pushes the ContentController onto the stack with
[self.navigationController pushViewController:contentController animated:YES]
When viewing the content, you can click the back button to return to the settings controller. If the application is in portrait mode, everything works correctly.
However, when the application is in landscape, and I press the back button, everything goes quickly. The view controller stack is updating correctly (for example, I see the SetupController view), but the UINavigationBar is not updating properly. The UINavigation panel items associated with the ContentController are still displayed. To see how SetupCotroller expects UINavigationBar elements, I have to press the back button a second time, after which the UINavigationBar will revive the correct state. Again, this only happens in landscape mode, portrait mode works fine.
As a test. In the [SetupController viewDidAppear:] method, I added the following debug output
if(self.navigationController.navigationBar.topItem != self.navigationItem) { NSLog(@"wrong nav item!"); } else { NSLog(@"correct nav item!"); }
I get a βwrongβ message whenever the simulator is in landscape mode, and never when it is in portrait mode. I tried to delete all viewDidAppear: messages both from ViewControllers, and from any cases when I change their navigation elements or navigation bar.
Any thoughts? I suppose I'm doing something wrong here, but that surely seems like a mistake to me.
source share