Xamarin表格iOS状态栏文字颜色
我无法将Xamarin Forms iOS应用程序的状态栏文字颜色更改为白色。我在我的info.plist变化如下:Xamarin表格iOS状态栏文字颜色
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
但颜色仍然保持黑色..有另一种方式来更改状态栏文本颜色?
在Xamarin.Forms中,需要做三件事才能在iOS状态栏中实现白色文本。我还发布了一个示例Xamarin.Forms应用程序,它在iOS状态栏中使用白色文本。
1.更新的Info.plist
在Info.plist
,添加布尔属性View controller-based status bar appearance
和其值设置为No
2.使用NavigationPage &设置导航栏文字颜色到白色
在Application
类(通常App.cs
),则MainPage
必须为NavigationPage
,和BarTextColor
必须设置为Color.White
3.清洁&重建应用
有时直到你清洁编译器不更新状态栏的颜色和重建应用程序,因此在步骤1 & 2中进行更改后,请清洁该应用程序并重新构建它。
示例应用程序
https://github.com/brminnick/SaveImageToDatabaseSampleApp/blob/master/README.md
更改状态栏在IOS对我来说是使用在FinishedLaunching这个代码在AppDelegate中
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication (.....);
app.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
return base.FinishedLaunching (app, options);
}
它不工作 – Singapore
谢谢你的答案的唯一途径!但是现在我没有状态栏了:/ – Huby03
哦,不!你介意在*上作为一个新问题并向我发送链接吗?我可以张贴一些截图来帮助你调试这个问题 –
嘿,在这里你去:https://*.com/questions/44321309/xamarin-ios-status-bar-text-color 谢谢 – Huby03