Search code examples
iosuicollectionviewuinavigationbarios13preferslargetitles

iOS 13 - Buggy Large Title UINavigationBar while pushing


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:

enter image description here

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


Solution

  • 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.

    The reason is written from Apple Doc:

    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.

    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).

    I wrote an article that explain a bit more about this: https://www.morningswiftui.com/blog/fix-large-title-animation-on-ios13