【发布时间】:2019-10-14 07:33:08
【问题描述】:
我正在尝试在 iOS 13 中为 Xamarin 自定义导航栏颜色,但它不起作用我尝试了下面的代码
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
var appearance = new UINavigationBarAppearance();
appearance.ConfigureWithOpaqueBackground();
appearance.BackgroundColor = Utility.ColorConstants.NavigationBarColor;
appearance.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White };
appearance.LargeTitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White };
UIBarButtonItem.Appearance.SetTitleTextAttributes(new UITextAttributes
{
TextColor = UIColor.White
}, UIControlState.Normal);
UINavigationBar.Appearance.ScrollEdgeAppearance = appearance;
UINavigationBar.Appearance.StandardAppearance = appearance;
}
在启动应用程序的应用委托类中,我正在调用上面的代码来设置导航栏的外观,但它不起作用。
请遇到此问题的任何人帮助我。
【问题讨论】:
标签: ios xamarin.ios ios13