From d1885b44657bb573f3b2aa00cf5e36ed03c41eaa Mon Sep 17 00:00:00 2001 From: ytn3rd Date: Tue, 19 Jul 2016 09:25:47 +1000 Subject: ixed issues where you could not force rotation with a NavigationPage on iOS. (#254) --- .../Renderers/NavigationRenderer.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index 9f2c2666..fcc37522 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -946,6 +946,40 @@ namespace Xamarin.Forms.Platform.iOS if (_navigation.TryGetTarget(out n)) n.UpdateToolBarVisible(); } + + public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() + { + IVisualElementRenderer childRenderer; + if (Child != null && (childRenderer = Platform.GetRenderer(Child)) != null) + return childRenderer.ViewController.GetSupportedInterfaceOrientations(); + return base.GetSupportedInterfaceOrientations(); + } + + public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation() + { + IVisualElementRenderer childRenderer; + if (Child != null && (childRenderer = Platform.GetRenderer(Child)) != null) + return childRenderer.ViewController.PreferredInterfaceOrientationForPresentation(); + return base.PreferredInterfaceOrientationForPresentation(); + } + + public override bool ShouldAutorotate() + { + IVisualElementRenderer childRenderer; + if (Child != null && (childRenderer = Platform.GetRenderer(Child)) != null) + return childRenderer.ViewController.ShouldAutorotate(); + return base.ShouldAutorotate(); + } + + public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) + { + IVisualElementRenderer childRenderer; + if (Child != null && (childRenderer = Platform.GetRenderer(Child)) != null) + return childRenderer.ViewController.ShouldAutorotateToInterfaceOrientation(toInterfaceOrientation); + return base.ShouldAutorotateToInterfaceOrientation(toInterfaceOrientation); + } + + public override bool ShouldAutomaticallyForwardRotationMethods => true; } void IEffectControlProvider.RegisterEffect(Effect effect) -- cgit v1.2.3