Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Forcing Landscape for a single page in iOS

$
0
0

I know this question has been asked in various ways but I haven't seen a valid answer yet.

I have an application that runs in portrait mode for the most part, I have one page the needs to be forced into landscape. I am using a custom page renderer on that page and it already uses a custom viewcontroller.

This should be simple, I've tried all the obvious things:

    public override void ViewWillAppear(bool animated)
    {
        UIApplication.SharedApplication.SetStatusBarOrientation(UIInterfaceOrientation.LandscapeLeft, true);
        base.ViewWillAppear(animated);
    }

    public override bool ShouldAutorotate()
    {
        return false;
    }

    public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation interfaceOrientation)
    {
        return interfaceOrientation == UIInterfaceOrientation.LandscapeLeft || interfaceOrientation == UIInterfaceOrientation.LandscapeRight;
    }

    public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
    {
        return UIInterfaceOrientationMask.Landscape;
    }

ideally I would like to force the entire app into portrait with the exception of this page.

Ideas?

Thanks,
Steve


Viewing all articles
Browse latest Browse all 77050

Trending Articles