在我的 Xamarin 專案中,在 XAML 檔案的標頭中,我設定了:
Shell.BackgroundColor="DarkGreen"
xaml 標頭宣告的一部分如下所示:

在 Android 上一切正常(查看下圖),但在 iOS 上,輔助工具列(以紅色方塊顯示)是白色的,我不明白為什么會發生這種情況,我該如何解決這個問題?

uj5u.com熱心網友回復:
您可以添加 itemsApp->AppDelegate.cs->FinishedLaunching 方法:
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
UITabBar.Appearance.TintColor = UIColor.Blue;
UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
}
FinishedLaunching 的完整方法是:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
UITabBar.Appearance.TintColor = UIColor.Blue;
UINavigationBar.Appearance.BackgroundColor = UIColor.Blue;
}
return base.FinishedLaunching(app, options);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/461943.html
