summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-11-16 20:14:00 (GMT)
committerGitHub <noreply@github.com>2016-11-16 20:14:00 (GMT)
commit20adf7ec74c02f8522b12c14dbb1b5eec3a0dfee (patch)
tree92efe42b8cbc1a99eea00e6bf968b75922e98b01 /Xamarin.Forms.Platform.iOS
parente5af21fdc32972d4355af86349d446a2bb6a5b02 (diff)
downloadxamarin-forms-20adf7ec74c02f8522b12c14dbb1b5eec3a0dfee.zip
xamarin-forms-20adf7ec74c02f8522b12c14dbb1b5eec3a0dfee.tar.gz
xamarin-forms-20adf7ec74c02f8522b12c14dbb1b5eec3a0dfee.tar.bz2
[iOS] Add Platform Specific option to not adjust the status bar text color based on the luminosity of the NavigationBar text color (#517)
* Add reproduction for 37431 * [Core] Add iOS PS StatusBarTextColorMode * [iOS] Implement StatusBarTextColorMode on NavPage * Add reproduction for 44777 * Add instructions to 44777 repro * Update docs
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs16
1 files changed, 9 insertions, 7 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
index 0d6601c..18000b7 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
@@ -418,7 +418,7 @@ namespace Xamarin.Forms.Platform.iOS
UpdateTint();
if (e.PropertyName == NavigationPage.BarBackgroundColorProperty.PropertyName)
UpdateBarBackgroundColor();
- else if (e.PropertyName == NavigationPage.BarTextColorProperty.PropertyName)
+ else if (e.PropertyName == NavigationPage.BarTextColorProperty.PropertyName || e.PropertyName == PlatformConfiguration.iOSSpecific.NavigationPage.StatusBarTextColorModeProperty.PropertyName)
UpdateBarTextColor();
else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
UpdateBackgroundColor();
@@ -572,23 +572,25 @@ namespace Xamarin.Forms.Platform.iOS
NavigationBar.TitleTextAttributes = titleAttributes;
}
+ 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
+ NavigationBar.TintColor = barTextColor == Color.Default || statusBarColorMode == StatusBarTextColorMode.DoNotAdjust
? UINavigationBar.Appearance.TintColor
: barTextColor.ToUIColor();
}
- if (barTextColor.Luminosity > 0.5)
+ if (statusBarColorMode == StatusBarTextColorMode.DoNotAdjust || barTextColor.Luminosity <= 0.5)
{
- // Use light text color for status bar
- UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
+ // Use dark text color for status bar
+ UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
}
else
{
- // Use dark text color for status bar
- UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
+ // Use light text color for status bar
+ UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
}
}