Note that there are some explanatory texts on larger screens.

plurals
  1. PORotating view controllers within a hierarchy of Tab Bar Controller -> Navigation Controller -> View Controller
    text
    copied!<p>My app has a view controller hierarchy set up like this:</p> <pre><code>UITabBarController | UINavigationController | | | UIViewController | UINavigationController | UIViewController </code></pre> <p>All of my view controllers that are within this hierarchy override the method:</p> <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation </code></pre> <p>and return <code>YES</code> - therefore the view controller should be able to rotate to any rotation - even upside down.</p> <p>However, within this setup none of the view controllers successfully rotate. I was under the impression that navigation and tab bar controllers would rotate if their view controllers respond to rotating.</p> <p>Why won't my view controllers rotate?</p> <p>The only way I've been able to get them to rotate is by subclassing <code>UINavigationController</code> and overriding it's <code>shouldAutorotate</code> method, but this feels unnecessary to me and I was wondering if there's something I've missed to make this work.</p> <h2>Edit:</h2> <p>According to the User Experience Coding How-to:</p> <blockquote> <p>If you are also using a toolbar, the view controller for each toolbar item must implement the shouldAutorotateToInterfaceOrientation: method and return YES for each of the orientations you wish to support. If you have a navigation controller for a toolbar item, the root view controller of that navigation controller must implement the shouldAutorotateToInterfaceOrientation: method and return YES.</p> </blockquote> <p>It says 'toolbar' - but I think this is a typo and is probably supposed to be 'tab bar'.</p> <p>So it seems that I'm implementing this correctly, yet my controllers still do not auto rotate.</p>
 

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