Your code should look like this:
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
Also, make sure in your Info.plist
you have set the correct orientations for you app because what you return from supportedInterfaceOrientations
is intersected with the Info.plist
and if it can't find a common one then you'll get that error.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…