You need to override shouldAutorotateToInterfaceOrientation
. A good place to put this is in the app delegate.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
return YES;
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone &&
UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
return YES;
}
return NO;
}
I'm not sure, but this may also support the phone being upside-down, which is a HIG no no. You might want to use interfaceOrientation == UIInterfaceOrientationPortrait
instead for the phone.