Note that there are some explanatory texts on larger screens.

plurals
  1. POUINavigationController and autorotation
    primarykey
    data
    text
    <p>I have a UIViewController that returns <code>YES</code> in <code>shouldAutorotateToInterfaceOrientation:</code> for <code>UIDeviceOrientationPortrait</code> and <code>NO</code> for everything else. With that view on the top of the stack, I use <code>pushViewController:animated:</code> to push a new <code>UIViewController</code>. The new controller returns <code>YES</code> for anything in <code>shouldAutorotateToInterfaceOrientation:</code>.</p> <p>The first view refuses to rotate (as expected). Once the second view is pushed, the user can rotate the device and the UI will rotate (also as expected). If the second view is in landscape mode and the user presses the back button (which calls <code>popViewControllerAnimated:</code>), the first view will appear rotated (<strong>unexpected!</strong>).</p> <p>If the user rotates the device back to portrait orientation, the view will rotate and then be stuck in portrait mode as before. This works but it's ugly for the user until they rotate back. So I'm in search of a way to make this view stay in portrait mode.</p> <p>The only workaround I have found so far is to use <code>-[UIDevice setOrientation:]</code>, which throws a warning (<code>orientation</code> is read-only) but works since it is actually defined. This is a huge hack and I'd like a real solution. In search of a real solution I attached GDB to the Photos application (MobileSlideshow.app) and discovered that it too uses <code>-[UIDevice setOrientation:]</code>. Being an internal application though I guess they have different rules.</p> <p>Is there a correct way to achieve the expected autorotation behavior?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload