Xamarin Forms iOS status bar text color

Viewed 20011

I am unable to change the status bar text color of my Xamarin Forms iOS app to white. I have change in my info.plist as follow:

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

Yet the color still remain black.. Is there another way to change the status bar text color?

5 Answers

So what I did for changing status bar color and status bar text color is:

Info.plist

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<!--<key>UIStatusBarHidden</key>-->
<!--<true/>-->

AppDelegate

Inside function FinishedLaunching(), add code below:

UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
if (statusBar != null && statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
{
    statusBar.BackgroundColor = Color.FromHex("#7f6550").ToUIColor(); // change to your desired color 
}

App.xaml

I added code below to change status bar text color to White.

<Style TargetType="{x:Type NavigationPage}">
     <!--<Setter Property="BarBackgroundColor" Value="Black" />-->
     <Setter Property="BarTextColor" Value="White" />
</Style> 

In my case, adding this to AppDelegate FinishedLaunching worked:

UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
Related