C# Xamarin.Forms 5.0导航栏背景颜色在IOS上未更改
我在C# Xamarin.Forms 5.0导航栏背景颜色在IOS上未更改,c#,xamarin.forms,colors,xamarin.ios,navbar,C#,Xamarin.forms,Colors,Xamarin.ios,Navbar,我在AppDelegate.cs函数FinishedLaunching中有此代码: UINavigationBar.Appearance.BackgroundColor= Color.FromHex("07987f").ToUIColor(); UINavigationBar.Appearance.BarTintColor = Color.FromHex("07987f").ToUIColor(); UINavigationBar.Appearan
AppDelegate.cs
函数FinishedLaunching
中有此代码:
UINavigationBar.Appearance.BackgroundColor= Color.FromHex("07987f").ToUIColor();
UINavigationBar.Appearance.BarTintColor = Color.FromHex("07987f").ToUIColor();
UINavigationBar.Appearance.TintColor = Color.White.ToUIColor();
UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.White };
在将Xamarin.Forms4.8
更新为5.0
之前,此代码适用于每个导航栏,但现在仅显示白色TintColor
和TextColor
工作正常。有什么问题吗?
图片:
您应该尝试使用NavigationPage类使用Xamarin.Forms指定它
可以肯定的是,某些代码会在代码之后应用颜色,因此您需要禁用它(如果可能)或覆盖它(如上所述)。创建导航页面时,您可以在Xamarin.forms中设置颜色:
MainPage = new NavigationPage(new MainPage()) {
BackgroundColor = Color.FromHex("07987f"),
BarBackgroundColor = Color.FromHex("07987f")
};
我在Github中也看到了关于此问题的线程,您可以在那里等待响应:
你有什么样的样品吗?我加了一张照片。这可能是Xamarin的最后一个版本。我会每天检查这篇文章。如果得到修复,我会写一个答案是的,我也可以在最新版本中重现这个问题。您可以尝试使用我的代码作为解决方法。但是,我必须在每个页面上添加您的代码否,这是创建导航页面时App.cs中的设置。好的,等待Github的响应。