1

I'm implementing these methods for rotation but they don't work:

-(BOOL)shouldAutorotate {
    return NO;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationLandscapeRight;
}

I want to force only one view to landscape and lock the rotation, but the app doesn't catch this methods, and I don't know why. Any solution?

David
  • 69
  • 1
  • 9

1 Answers1

1

In youar appdelegate add this method,

 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{

    if ([self.window.rootViewController.presentedViewController isKindOfClass: [SecondViewController class]])
{
    return UIInterfaceOrientationMaskAll; // or UIInterfaceOrientationMaskLandscape for landscape and more you can set
}
    else return UIInterfaceOrientationMaskPortrait;
}

In above code second view controller is your desired view to show in landscape.

Hope this will help :)

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75