My goal is to force landscape orientation on a single view controller, not the entire app (to be exact: I want to make my camera view controller to be landscape only)
I've been running into the issue not being able to force landscape on iOS 10 devices with Xamarin.iOS.
I've got it working on iOS 9 or lower by overriding the following methods in the view controller that is supposed to be in landscape only. However, these methods don't seem to be called on iOS 10.
public override bool ShouldAutorotate()
{
return true;
}
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
{
return UIInterfaceOrientation.LandscapeLeft;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return UIInterfaceOrientationMask.Landscape;
}
I also tested calling this method from ViewDidLoad (I'm not using this line anymore and can't tell if it has any effect)
//AppDelegate
public void ChangeOri()
{
UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.LandscapeLeft), new NSString("orientation"));
}
Any suggestions on a possible workaround?