I’m trying to show different orientation depending on device.
On iPhone I want to allow portrait orientation, on iPad I want to allow landscapeleft orientation.
Is that possible?
I tried
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
else {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
}
The code you posted does the job. However you need to add Supported Device Orientations to Info.plist. The easiest way to do this is to select appriopriate settings in
Project->Target->Summary->Supported Device Orientationssection.