Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

On iOS, can I set the StatusBar text color independently of the NavigationPage.BarTextColor?

$
0
0

I have a Xamarin.Forms app I've been working on and I can't seem to set the colors as I'd like on iOS. I'm using a NavigationPage as the main page of the app with a normal content page inside of it. Forms v1.5.0.6446

Since I'm using a dark NavigationPage.BarBackgroundColor (Navy Blue in this example), I need the StatusBar text color to be White (or LightContent style), and the BarTextColor to be a different color (Yellow in this example). I've attached an image to illustrate what I need.

The issue I'm running into is that the NavigationPage.BarTextColor controls both the BarTextColor and the StatusBar text color. There must be some logic built into Xamarin.Forms that is doing this. What I've found is that if I set the BarTextColor to some light colors like Silver and Pink, then the StatusBar text will be white. But setting the BarTextColor to "darker" colors, like Yellow, or even Aqua (!), will result in StatusBar text that is Black. It appears they've made some decisions for me, and I don't like that :)

This setting in the Info.Plist file appears to be critical. Without it, I couldn't get the StatusBar text color to be white. No matter what I did, it was always black:
View controller-based status bar appearance: No

None the forum posts or examples I've seen do what I need specifically; they're happy setting both text colors to white, while I need them to differ.

I've tried setting the StatusBarStyle directly in my iOS AppDelegate like this:
UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
But this doesn't have any effect.

I've also tried setting the Status Bar Style in the Info.plist file - no effect either.

I created a small sample project that I'll attach as well. I'd appreciate any ideas. Thanks!


Viewing all articles
Browse latest Browse all 75885

Trending Articles