Search code examples
iphoneios6uiinterfaceorientation

Unsupport Orientation in iOS6


My app is totally work only on portrait mode, but I have only one UIViewController that needs to be only in landscape mode in iOS6.

So:

  • One UIViewController should only support landscape mode.
  • The others UIViewController should only support portrait mode.

If I change on supported Interface Orientations to support both modes, I can't prevent them from rotate.


Solution

  • The problem is (I assume) that you are using a UINavigationController interface. iOS doesn't support forcing different view controllers in a navigation interface into different orientations.

    Indeed, the individual view controllers are not even consulted. You have to subclass UINavigationController itself and have it dictate the orientation.

    But even then you won't be able to force rotation when changing view controllers. The only way to do that is with a presented view controller.

    This has been explained many, many, many times here on Stack Overflow. Please search before posting.