0

My iPad app is set to support both landscape orientations (left and right). When I run it in the 6.0 or 6.1 simulator it behaves as expected. But in 5.1, it is locked to portrait (up or down, I can't tell) and doesn't re-orient when the simulator is rotated.

Edit: This has been marked as duplicate to this question: Supporting both iOS 6 and iOS 5 autorotation

I'm changing the question to ask, how can this be done without having to add this function:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

To every view controller?

Community
  • 1
  • 1
abc123
  • 8,043
  • 7
  • 49
  • 80
  • That is because the way orientation is handled is different between iOS5 and iOS6. I found this answer helpful: http://stackoverflow.com/a/13800907/620197 – Mike D Mar 21 '13 at 03:15
  • return YES in shouldAutorotateToInterfaceOrientation – LE SANG Mar 21 '13 at 03:18

1 Answers1

3

You need to override the below method like this to support orientation as per your requirement in ios 5.1 and early versions...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
Bhanu Prakash
  • 1,493
  • 8
  • 20