I am developing an application for iOS in Xamarin, I have a login screen as my first view which I want to display as portrait only and the rest can do landscape or whatever.
As this is in C# these are the methods I have overridden in my ViewController
but the view still rotates on my iPhone
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
{
return UIInterfaceOrientationMask.Portrait;
}
public override bool ShouldAutorotate ()
{
return false;
}
I am probably missing something very simple but I just can't get it to work.
I am also attempting to use AutoLayout if that makes any difference.
First make sure you have checked all the orientations in General settings:
and in whatever
UIViewController
you wish only the portrait mode add the following snippet:@user1049099 I'm using Xamarin too with a
UIViewController
, I managed to force portrait, but this only works on iPhone. On Ipad, if launching the app in landscape mode, it gets stuck.When calling those three functions manually, they return false, Portrait and Portrait (in order) even if it's not the case on Ipad.