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

Locking orientation in Xamarin.Forms

$
0
0

I'm trying to lock the screen orientation programmatically in my Xamarin.Forms app. I could not find a solution that is supported across devices, so I'm using the Dependency Service to implement it for each platform. I think I will manage the WP and Android platform, but I'm struggling with IOS. From googling around I suspect that a property or method should be available on the UIViewController, but I only find ShouldAutorotate(), that only return a bool.

var root = UIApplication.SharedApplication.KeyWindow.RootViewController.NavigationController;
var ctrl = root.TopViewController;
// I'm stuck

Any ideas?


Viewing all articles
Browse latest Browse all 58056

Trending Articles