I'm confused about the implementation of autorotation in ios.
I have a UIViewController, and I tell it to autorotate inside shouldAutoRotateToInterfaceOrientation. However, it doesn't work.
So I read something about how I need to look at the navigation stack AND/OR whether a UITabBarController was used, because this has been known to cause all kinds of confusion (raises hand).
In fact, I have a UITabBar and a UINavigationController. The UIView that I want to rotate is being pushed onto the stack three or four 'levels' deep.
Why isn't autorotation solely determined by whatever the shouldAutoRotateToInterfaceOrientation returns inside the current UIViewController?
From apple's technical doc located at: https://developer.apple.com/library/ios/#qa/qa2010/qa1688.html about why a UIViewController may not be rotating when you expect it to:
All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set.
To make sure that all your child view controllers rotate correctly, you must implement shouldAutorotateToInterfaceOrientation for each view controller representing each tab or navigation level. Each must agree on the same orientation for that rotate to occur. That is, they all should return YES for the same orientation positions.
Can someone summarize what facts we need to be aware of when working with UITabBars and UINavigationControllers? Where do people commonly mess up or what are points of muddiness?
If you have a UITabBar, UITabBarController, or UINavigationController, all of its child views need to have the same autorotation behavior. But surely you can have some child views rotate and others not rotate, right?
I suspect that common reasons for failing have to do with not understanding the responder chain well enough as it applies to autorotation. If so, can someone clear this up for me? Then I might be able to figure out 'selective autorotation'.
To add to this, other posts indicate that you must subclass UITabBarController and override shouldAutorotateToInterfaceOrientation.