4

I want to show one view in landscape forcibly. All other views are in portrait.

I tried the code below to show landscape mode while coming from portrait mode. It is not working.

How can I do this?

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        if ((interfaceOrientation == UIInterfaceOrientationMaskLandscape) ||
            (interfaceOrientation == UIInterfaceOrientationMaskLandscapeLeft) ||
            (interfaceOrientation == UIInterfaceOrientationMaskLandscapeRight))
        {
            return YES;
        }
        return NO;
    }

    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return UIInterfaceOrientationLandscapeRight;
    }

    -(BOOL)shouldAutorotate{
        return NO;
    }

    -(NSInteger)supportedInterfaceOrientations{
        return UIInterfaceOrientationMaskLandscape;
    }
John Hascall
  • 9,176
  • 6
  • 48
  • 72
  • 3
    http://stackoverflow.com/questions/12640870/ios-6-force-device-orientation-to-landscape Please check this question answered by Sava Mazăre. – Noufal Kmc Jul 30 '13 at 06:53
  • Possible duplicate of [IOS 6 force device orientation to landscape](https://stackoverflow.com/questions/12640870/ios-6-force-device-orientation-to-landscape) – Ashley Mills Jul 05 '18 at 12:05

0 Answers0