iOS 13-推送时,Buggy大标题UINavigationBar [英] iOS 13 - Buggy Large Title UINavigationBar while pushing
问题描述
在iOS 13更新中,当我的 UINavigationBar
上有 prefersLargeTitles = true
时,我仍然无法解决一个烦人的错误,我进行了推举.另外,即使我不确定100%是否与之相关,我的视图控制器也嵌入了一个集合视图.
With the iOS 13 update, I've got an annoying bug that I still wasn't able to solve when I have the prefersLargeTitles = true
on my UINavigationBar
and I perform a push segue.
Plus, even if I'm not 100% sure if it's related to it, my view controller has a collection view embedded.
无论如何,我正在谈论的错误/故障如下:
Anyway the bug/glitch I'm talking about is the following:
基本上,该文本没有像我推动时所期望的那样动画,并且一直保持在那里直到出现新屏幕.有小费吗?谢谢
Basically the text doesn't animate as I would expect when I'm pushing, and it continues to stay there till the new screen is presented. Any tips? Thanks
推荐答案
我遇到了同样的问题.尝试将第一个VC的 navigationItem.largeTitleDisplayMode
设置为 .always
,然后将第二个VC的 .never
设置为 with 在两种情况下 prefersLargeTitles = true
.
I had the same issue. Try to set navigationItem.largeTitleDisplayMode
to .always
for your first VC and then .never
for your second VC with prefersLargeTitles = true
in both cases.
原因是从Apple Doc撰写的:
The reason is written from Apple Doc:
如果导航栏的preferredsLargeTitles属性为false,则此属性无效,并且导航项的标题始终显示为小标题.
If the prefersLargeTitles property of the navigation bar is false, this property has no effect and the navigation item’s title is always displayed as a small title.
这是导致动画故障的原因,而不仅仅是iOS13的错误,在iOS12/11上已经存在相反的情况(从第二个VC退回到第一个VC时发生动画故障).
Which is causing the animation glitch, and it's not a iOS13 bug only, on iOS12/11 it's already the case it's just the other way around (the animation glitch is happening when dismissing from the secondVC back to the firstVC).
我写了一篇文章,对这一点进行了更多解释: https://www.morningswiftui.com/blog/fix-large-title-animation-on-ios13
I wrote an article that explain a bit more about this: https://www.morningswiftui.com/blog/fix-large-title-animation-on-ios13
这篇关于iOS 13-推送时,Buggy大标题UINavigationBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!