diff options
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs | 57 |
1 files changed, 14 insertions, 43 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index adf32192..55e39ada 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -182,13 +182,7 @@ namespace Xamarin.Forms.Platform.iOS { base.ViewDidLoad(); - if (Forms.IsiOS7OrNewer) - { - - UpdateTranslucent(); - } - else - WantsFullScreenLayout = false; + UpdateTranslucent(); _secondaryToolbar = new SecondaryToolbar { Frame = new RectangleF(0, 0, 320, 44) }; View.Add(_secondaryToolbar); @@ -454,11 +448,6 @@ namespace Xamarin.Forms.Platform.iOS void UpdateTranslucent() { - if (!Forms.IsiOS7OrNewer) - { - return; - } - NavigationBar.Translucent = ((NavigationPage)Element).OnThisPlatform().IsNavigationBarTranslucent(); } @@ -571,18 +560,9 @@ namespace Xamarin.Forms.Platform.iOS { var barBackgroundColor = ((NavigationPage)Element).BarBackgroundColor; // Set navigation bar background color - if (Forms.IsiOS7OrNewer) - { - NavigationBar.BarTintColor = barBackgroundColor == Color.Default - ? UINavigationBar.Appearance.BarTintColor - : barBackgroundColor.ToUIColor(); - } - else - { - NavigationBar.TintColor = barBackgroundColor == Color.Default - ? UINavigationBar.Appearance.TintColor - : barBackgroundColor.ToUIColor(); - } + NavigationBar.BarTintColor = barBackgroundColor == Color.Default + ? UINavigationBar.Appearance.BarTintColor + : barBackgroundColor.ToUIColor(); } void UpdateBarTextColor() @@ -616,12 +596,9 @@ namespace Xamarin.Forms.Platform.iOS var statusBarColorMode = (Element as NavigationPage).OnThisPlatform().GetStatusBarTextColorMode(); // set Tint color (i. e. Back Button arrow and Text) - if (Forms.IsiOS7OrNewer) - { - NavigationBar.TintColor = barTextColor == Color.Default || statusBarColorMode == StatusBarTextColorMode.DoNotAdjust - ? UINavigationBar.Appearance.TintColor - : barTextColor.ToUIColor(); - } + NavigationBar.TintColor = barTextColor == Color.Default || statusBarColorMode == StatusBarTextColorMode.DoNotAdjust + ? UINavigationBar.Appearance.TintColor + : barTextColor.ToUIColor(); if (statusBarColorMode == StatusBarTextColorMode.DoNotAdjust || barTextColor.Luminosity <= 0.5) { @@ -679,18 +656,13 @@ namespace Xamarin.Forms.Platform.iOS #pragma warning disable 0618 //retaining legacy call to obsolete code var tintColor = ((NavigationPage)Element).Tint; #pragma warning restore 0618 - if (Forms.IsiOS7OrNewer) - { - NavigationBar.BarTintColor = tintColor == Color.Default - ? UINavigationBar.Appearance.BarTintColor - : tintColor.ToUIColor(); - if (tintColor == Color.Default) - NavigationBar.TintColor = UINavigationBar.Appearance.TintColor; - else - NavigationBar.TintColor = tintColor.Luminosity > 0.5 ? UIColor.Black : UIColor.White; - } + NavigationBar.BarTintColor = tintColor == Color.Default + ? UINavigationBar.Appearance.BarTintColor + : tintColor.ToUIColor(); + if (tintColor == Color.Default) + NavigationBar.TintColor = UINavigationBar.Appearance.TintColor; else - NavigationBar.TintColor = tintColor == Color.Default ? null : tintColor.ToUIColor(); + NavigationBar.TintColor = tintColor.Luminosity > 0.5 ? UIColor.Black : UIColor.White; } void UpdateToolBarVisible() @@ -776,8 +748,7 @@ namespace Xamarin.Forms.Platform.iOS public ParentingViewController(NavigationRenderer navigation) { - if (Forms.IsiOS7OrNewer) - AutomaticallyAdjustsScrollViewInsets = false; + AutomaticallyAdjustsScrollViewInsets = false; _navigation = new WeakReference<NavigationRenderer>(navigation); } |