BarTintColor 不适用于 Xamarin 中 iOS 13 中的 PrefersLargeTitles

Posted

技术标签:

【中文标题】BarTintColor 不适用于 Xamarin 中 iOS 13 中的 PrefersLargeTitles【英文标题】:BarTintColor does not work with PrefersLargeTitles in iOS 13 in Xamarin 【发布时间】:2019-08-22 19:22:02 【问题描述】:

当我尝试为 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
;

在 iOS 12 中,它看起来像这样

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

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

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

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

【问题讨论】:

嗨,现在 xamarin 可能与 iOS13 不完全兼容。 IOS 13是beta版,稳定版的时候可以试试,如果到时候还有问题,可以认为是issue。 我完全明白了——但两个测试版都接近尾声了。除了作为测试版之外,还希望解决问题。我不是说这是 beta 版的问题,我是说我在版本之间遇到了这个问题,不知道发生了什么。 好吧,虽然两个节拍都接近尾声了,但是发布版本后一切都准备好了。不仅是IOS版本,Xamarin.Forms版本也准备好适配了。跨度> 此处不使用 Xamarin 表单。这在本机 iOS 应用程序中也可以正常工作。向项目提交反馈。我们正在对我们的东西进行更新,以便在发布的同时准备好。 Okey,如果得到解决方案将在这里分享。 【参考方案1】:

这是 12.99.3.5 之前 Xamarin 中的一个错误。

在 12.99.3.5 中,新的 ScrollEdgeAppearance 属性可用,但也不起作用。

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

可以通过https://github.com/xamarin/xamarin-macios/issues/6834跟踪进度

【讨论】:

以上是关于BarTintColor 不适用于 Xamarin 中 iOS 13 中的 PrefersLargeTitles的主要内容,如果未能解决你的问题,请参考以下文章