iKK
iKK

Reputation: 7012

NavigationBar prefersLargeTitle not working

Using iOS 13.3,

I observe a strange behaviour of the navigationBar. If dragging up, the navigationBar contracts. (see video)

Don't worry about the tabs that are part of the navigationBar. The strange behaviour also happens without them. And also the fact that the ViewController presents in a modal sheet is irrelevant - the strange contraction behaviour also happens in a classic view. So far, I only knew this contracting behaviour from a SearchBar. But no such is present here.

How can I always keep the navigationBar at a fixed large size ?

enter image description here

I tried without success....

navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always

Upvotes: 0

Views: 161

Answers (1)

iKK
iKK

Reputation: 7012

I finally found the solution:

Since there was a tableView in the screen, the following was needed to prevent the contracting of the navigationBar:

tableView.isScrollEnabled = false

If your navigationBar has a custom height or for other reasons, you can also set the tableView's Insets to place it downwards like this:

tableView.contentInset = UIEdgeInsets(top: 90.0, left: 0.0, bottom: 0.0, right: 0.0)

Upvotes: 0

Related Questions