更改文本颜色时,Xamarin.iOS状态栏消失

时间:2017-06-02 05:18:03

标签: c# ios xamarin xamarin.forms xamarin.ios

如何在更改文本颜色时避免在Xamarin.iOS上隐藏状态栏?

尝试更改iOS状态栏的颜色后,我再也没有状态栏了。

我删除了info.plist中添加的属性,但我的状态栏文字颜色仍为黑色。

这就是我所做的,following these steps

  • 更新了info.plist添加布尔属性View Controller-Based Status Bar Appearance并将其设置为No
  • 在App.cs中,在我的MainPage中添加了一个NavigationPage BarTextColor = Color.White

2 个答案:

答案 0 :(得分:3)

隐藏iOS状态栏有几种方法。以下是Xamarin.iOS源代码中要验证的内容:

1。 Info.plist设置

Info.plist中,确保Status bar is initially hiddenNo

enter image description here

2。 StatusBarHidden属性

搜索代码以查找对UIApplication.SharedApplication.StatusBarHidden的任何引用,并确保其为false

enter image description here

答案 1 :(得分:1)

更改状态栏颜色:

在App.xaml.cs中:

MainPage = new NavigationPage(new MainPage())
{
    BarBackgroundColor = Color.FromHex("Your color code here"),
    BarTextColor = Color.White
};
Info.plist中的

<key>UIViewControllerBasedStatusBarAppearance</key>           

检查此网址:http://www.fabiocozzolino.eu/change-ios-status-bar-color-xamarin-forms/

相关问题