Forum Xamarin.iOS

Xamarin Forms Orientation on iOS

DanSiegelDanSiegel USUniversity ✭✭

I'm working on a Xamarin Forms application that can support any orientation, but I am limited by a requirement that the app needs to lock the rotation to Portrait only by default and users have to opt into allowing Landscape rotation. While it's easy enough to expose the setting in the app or in the Settings.bundle, I have not found a way that actually works to change the allowed rotation at runtime.

I have already tried the following in the AppDelegate, but that doesn't seem to actually do anything:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations( UIApplication application, UIWindow forWindow )
    if( PlatformSettings.Current.PortraitLock )
        return UIInterfaceOrientationMask.Portrait;

    return UIInterfaceOrientationMask.All;


Sign In or Register to comment.