1

As the title describes I am having a big problem with the orientation in my app atm. It seems I can't get the control over the orientation at all in the different slides. The following things have I tried and works/not works in my app:

  • Xcode refuse listen to any code given in the shouldAutorotateToInterfaceOrientation method at any slide.

  • Xcode refuse listen to any settings given in the stoaryboad for each slide.

  • Xcode listens to info-plist file, but from this file you can only set orientation for all Views/slides in the app. I want some slides to allow landscape-mode and others portrait-mode only.

I have tried to remove all UINavigationBars/Tabbars in my app and actualy only use 1 single ViewController as initial ViewController and the problem still occurs, can only manage orientation from info-plist file. Basicly the app resufses to listen to anything other then the info-plist file adjusting the orientation settings?

I have tried my best to understand the problem but I can not say I have gained any bigger "aha moment" so far since all possible ways apple offers to adjust the settings simply doesnt work in my app atleast, great apple!.... Do we have anyone else who experienced this before or has heard of the problem before?

Jesper Martensson
  • 1,238
  • 3
  • 18
  • 44

1 Answers1

2

- (BOOL)shouldAutorotateToInterfaceOrientation: is deprecated in iOS 6.

You should override the - (NSUInteger)supportedInterfaceOrientations method of your UIViewController subclass.

Example:

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
}

Edit:

If you're using a UINavigationController, you must subclass that as well, and implement the logic above. This is expected functionality. Relevant StackOverflow Q/A:

iOS 6 bug: supportedInterfaceOrientations not called when nav controller used as window root

iOS 6 rotations: supportedInterfaceOrientations doesn´t work?

Set different supportedInterfaceOrientations for different UIViewControllers

Community
  • 1
  • 1
Daniel Amitay
  • 6,677
  • 7
  • 36
  • 43