Ios – UIApplicationInvalidInterfaceOrientation issue

iosuiviewcontroller

My app should only support Portrait mode but in one single view controller I want to be able to use landscape.
If I set supported device orientations in project to Portrait only and run the app < iOS6.0 it works fine, but with iOS6 it crashes with:
'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES.

Turning landscape on in project properties will always rotate all other viewcontrollers even if I use shouldAutorotate (iOS6) or shouldAutorotateToInterfaceOrientation (pre iOS6).

Any ideas?

Best Answer

Got it. Used this

Enabled portrait and landscape orientation in project settings, used category in app delegate and override

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

in my landscape viewcontroller

Related Topic