When using the UISplitViewController in navigating from Master to Detail the navigation bar animation does not work as expected. It "jumps" up instead of a smooth animation.
Steps to Reproduce:
Create project from template "Master detail App" in Xcode 9.
Add the following code into MasterViewController
in viewDidLoad
:
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
Add the following code in DetailViewController
in viewDidLoad
:
navigationItem.largeTitleDisplayMode = .never
Now navigate between Master and Detail in the iPhone simulator and you can see how the Navigation Bar "jumps" up on the DetailViewController instead of a smooth animation.
See video: https://youtu.be/p90I4VrM2fs
My assumption is that it has something to do with using two UINavigationController with the UISplitViewController. (which is how it is done)
Any ideas how to resolve this? Thanks.
I just found out the problem. prefersLargeTitles
and largeTitleDisplayMode
have to be set in awakeFromNib()
, not in viewDidLoad()
.