BarTintColor 不适用于 Xamarin iOS 13 中的 PrefersLargeTitles

BarTintColor does not work with PrefersLargeTitles in iOS 13 in Xamarin

因为我正在尝试为 iOS 13 准备我们的应用程序,所以我 运行 遇到了无法修复的渲染问题。

我们的 ViewDidLoad 中有这样的代码:

this.NavigationController.SetNavigationBarHidden(false, false);
this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(3, 117, 178);
this.NavigationController.NavigationBar.TintColor = UIColor.White;
this.NavigationController.NavigationBar.Translucent = false;
this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes
{
ForegroundColor = UIColor.White
};
View.BackgroundColor = UIColor.White;

this.NavigationController.NavigationBar.PrefersLargeTitles = true;
this.NavigationController.NavigationBar.LargeTitleTextAttributes = new UIStringAttributes
{
ForegroundColor = UIColor.White
};

在iOS12,看起来是这样的

刚刚为 13 编译,现在看起来像

但如果我滚动,它看起来确实正确(搜索除外)

我们之前从开发博客 https://devblogs.microsoft.com/xamarin/go-large-ios-11/ 中获得了很多此类信息,并且我在那里尝试了几次迭代。我什至也尝试将其中的一部分放入我们的 AppDelegate 中。

我可以更改文本(它实际上在这里工作,所以你什么也看不到)。它在没有设置 PrefersLargeTitles 的页面上工作正常。

这是 Xamarin 12.99.3.5 之前的错误。

在 12.99.3.5 中,新的 ScrollEdgeAppearance 属性 可用,但也没有用。

这已在 12.99.4.1 及更高版本中修复。

可以在 https://github.com/xamarin/xamarin-macios/issues/6834

跟踪进度