user3180081
user3180081

Reputation: 33

How to force landscape mode and show the screen only in landscape mode?

I have done all the below things, but the screen still auto rotates to portrait.

Correction: To make it clear, I need just one of the screens to go landscape and stay landscape only. The rest of them can orient with the device

    public override void ViewDidAppear(bool animated)
    {
        WillAnimateRotation(UIInterfaceOrientation.LandscapeLeft, 0.0);

        base.ViewDidAppear(animated);
    }
    public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
    {

        return UIInterfaceOrientationMask.Landscape;
    }

    public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
    {
        return UIInterfaceOrientation.LandscapeLeft;
    }
    public override bool ShouldAutorotate()
    {
        return false;
    }

Upvotes: 1

Views: 369

Answers (1)

Jason
Jason

Reputation: 89129

In your either the Project Options dialog, or in the info.plist editor, you can select which device orientations your app supports.

enter image description here

Upvotes: 2

Related Questions