-1

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.

Marckaraujo
  • 7,422
  • 11
  • 59
  • 97

2 Answers2

0

Yes you can, on each individual view controller implement supportedInterfaceOrientation and only pass UIInterfaceOrientationMaskPortrait to all your view controllers except the one you want rotated

Clint Warner
  • 1,265
  • 1
  • 9
  • 25
0

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.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • @markaraujo this is the best way… :) also, you can check my example http://stackoverflow.com/a/16481921/1702413 – TonyMkenu May 10 '13 at 12:11
  • @TonyMkenu, it is exactly what I need, could you create an example to work without storyboard? and post here as the correct question, many thx – Marckaraujo May 10 '13 at 17:54
  • @marckarauujo The Matt's answer.. Is the correct answer. For xib is the same thinks, just copy some code from my example – TonyMkenu May 10 '13 at 18:34