Xamarin.Forms iOS状态栏颜色与NavigationPage

Tre*_*ter 2 statusbar master-detail ios xamarin.forms

我正在使用Xamarin.Forms构建应用程序,在iOS应用程序上我希望状态栏颜色为白色.这是我到目前为止:

App.cs

public App()
{
    NavigationPage _navigationPage = new NavigationPage(new RootPage());

    MainPage = _navigationPage;
}
Run Code Online (Sandbox Code Playgroud)

Tre*_*ter 7

在最近的Xamarin更新之后,您现在可以通过设置BarTextColorProperty来完成此操作,

_navigationPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);

然而,就像在pvnak的回答中一样,您仍需要将以下内容添加到Info.plist中

  • 属性: UIViewControllerBasedStatusBarAppearance
  • 类型: boolean
  • 值: No