diff options
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/PlatformRenderer.cs | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs index 43534b2b..554c0f50 100644 --- a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs @@ -25,9 +25,43 @@ namespace Xamarin.Forms.Platform.iOS public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() { - return UIInterfaceOrientationMask.All; + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].GetSupportedInterfaceOrientations(); + } + + return base.GetSupportedInterfaceOrientations(); + } + + public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() + { + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].PreferredInterfaceOrientationForPresentation(); + } + return base.PreferredInterfaceOrientationForPresentation(); } + public override bool ShouldAutorotate() + { + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].ShouldAutorotate(); + } + return base.ShouldAutorotate(); + } + + public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) + { + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].ShouldAutorotateToInterfaceOrientation(toInterfaceOrientation); + } + return base.ShouldAutorotateToInterfaceOrientation(toInterfaceOrientation); + } + + public override bool ShouldAutomaticallyForwardRotationMethods => true; + public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); @@ -60,9 +94,42 @@ namespace Xamarin.Forms.Platform.iOS public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() { - return UIInterfaceOrientationMask.All; + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].GetSupportedInterfaceOrientations(); + } + return base.GetSupportedInterfaceOrientations(); } + public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() + { + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].PreferredInterfaceOrientationForPresentation(); + } + return base.PreferredInterfaceOrientationForPresentation(); + } + + public override bool ShouldAutorotate() + { + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].ShouldAutorotate(); + } + return base.ShouldAutorotate(); + } + + public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) + { + if ((ChildViewControllers != null) && (ChildViewControllers.Length > 0)) + { + return ChildViewControllers[0].ShouldAutorotateToInterfaceOrientation(toInterfaceOrientation); + } + return base.ShouldAutorotateToInterfaceOrientation(toInterfaceOrientation); + } + + public override bool ShouldAutomaticallyForwardRotationMethods => true; + public override void ViewDidAppear(bool animated) { Platform.DidAppear(); |