Xamarin Forms iOS状态栏文本颜色 [英] Xamarin Forms iOS status bar text color

查看:267
本文介绍了Xamarin Forms iOS状态栏文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将Xamarin Forms iOS应用程序的状态栏文本颜色更改为白色.我的info.plist中有如下更改:

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?

推荐答案

在Xamarin.Forms中,需要执行三件事来在iOS状态栏中实现白色文本.我还在下面发布了一个示例Xamarin.Forms应用程序,该应用程序在iOS状态栏中使用白色文本.

In Xamarin.Forms, there are three things you need to do to achieve white text in the iOS Status Bar. I've also posted a sample Xamarin.Forms app below that uses white text in the iOS Status Bar.

Info.plist中,添加布尔属性View controller-based status bar appearance并将其值设置为No

In Info.plist, add the Boolean Property View controller-based status bar appearance and set its value to No

Application类(通常为App.cs)中,MainPage必须为NavigationPage,并且BarTextColor必须设置为Color.White

In the Application class (typically App.cs), the MainPage must be a NavigationPage, and the BarTextColor must be set to Color.White

有时,在您清理并重建应用程序之前,编译器不会更新状态栏颜色,因此在步骤1和步骤2中进行更改后,编译器才会更新状态栏颜色. 2,清理应用程序并重建它.

Sometimes the compiler doesn't update the Status Bar Color until you Clean and Rebuild the app, so after making the changes in steps 1 & 2, clean the app and rebuild it.

https://github.com/brminnick/SaveImageToDatabaseSampleApp/

这篇关于Xamarin Forms iOS状态栏文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆