LouwHopley LouwHopley - 4 months ago 14
iOS Question

Universal app not rotating on iPad but does on iPhone

I have just completed building a universal app which rotates perfectly on my iPhone, but on the iPad it just stands still.

Similar to this question, but that does not solve my issue.

The supported interface orientations are all set to allow rotation and I have even set this in my app delegate:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}


Still the iPhone rotates fine, but the iPad won't move from portrait.

What could cause this, or rather how can I fix it?

[UPDATE]




  • The switch on the side is not on lock.

  • The orientations in the PList are set correctly.

  • The Project settings (where you select it via buttons) are set correctly.


Answer

I fixed this by adding this piece of code to every ViewController of mine:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{ 
    return UIInterfaceOrientationMaskAll; 
}

It seems like this question's answer was correct after all. I just thought it wasn't since I checked through all the ViewControllers and found nothing restricting it from turning.

Comments