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

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 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>