Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

popViewController does not autorotate back to allowed orientation

I have two UIViewControllers, "A" and "B", where "A" overrides the shouldAutorotateToInterfaceOrientation to return YES for UIInterfaceOrientationPortrait, and "B" returns YES for all orientations. In my example "A" is the root navigation view controller, and I then use pushViewController for "B". After that I rotate the device into landscape, which successfully autorotates "B", then I pop "B" (back button or via popViewController) to return to "A".

When targetting iPhone OS 3.1.3, "A" returns to the portrait orientation as expected. When targetting iPhone OS 3.2, I have two side-effects:

  1. "A" is displayed in landscape.
  2. The navigation bar does not update even though "A" is now displayed. The navigation bar still shows the items for "B". Only after trying to go back/pop one more time will the navigation bar animate to show the items for "A". If I instead attempt to push "B" again and go back, I have to pop twice before the navigation bar animates to show the items for "A". During these "intermediate pops" the view for "A" remains displayed.

While researching this issue, I have seen other answers suggesting performing the rotation manually ([UIDevice setOrientation] or via a tranformation), however this does not help understand what the problem is, especially why it behaves differently between the two OS's.

So my question is: must all of my UIViewControllers on the UINavigationController stack support exactly the same orientations going forward? And if not, then is there something that I need to do to make it behave as it did for OS 3.1.3?

like image 734
JoeGaggler Avatar asked May 07 '10 19:05

JoeGaggler


1 Answers

It would appear that the newer OS's require all UIViewControllers in the UINavigationController stack to support the same set of orientations.

like image 96
JoeGaggler Avatar answered Oct 16 '22 20:10

JoeGaggler