Xamarin iOS状态栏文字颜色
我无法将Xamarin Forms iOS应用程序的状态栏文本颜色更改为白色。 我已经尝试了在互联网上发现的多个解决scheme和堆栈溢出,他们都没有为我工作。 这就是我所做的:
- 更新我的info.plist,其中添加了布尔属性View Controller-Bases Status Bar Appearance ,并将其设置为No / False
- 我在App.cs中添加了我的MainPage,它是一个NavigationPage, BarTextColor = Color.White
问题是,现在我没有状态栏了,在这种情况下,我删除了info.plist中添加的属性,我的状态栏文本颜色保持黑色。 有什么我失踪?
有几种方法可以隐藏iOS状态栏。 以下是在Xamarin.iOS源代码中validation的事情:
1. Info.plist设置
在Info.plist
,确保Status bar is initially hidden
是No
2. StatusBarHidden
属性
search代码以查找对UIApplication.SharedApplication.StatusBarHidden
任何引用,并确保它是false
更改状态栏颜色:
在App.xaml.cs中:
MainPage = new NavigationPage(new MainPage()) { BarBackgroundColor = Color.FromHex("Your color code here"), BarTextColor = Color.White };
在Info.plist
:
<key>UIViewControllerBasedStatusBarAppearance</key>
检查这个url: http : //www.fabiocozzolino.eu/change-ios-status-bar-color-xamarin-forms/