iOS 14 Large title collapse when app run firstly

When I set :
Code Block
tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 60, right: 0)

The large title not show(small title instead of) when app first run, and it's right when I change contentInset's top to zero.

I setup large title by this code:
Code Block
navigationController?.navigationBar.prefersLargeTitles = true

I run it on iOS 13 is good, only break on iOS 14.
  • Did you solve this issue?

    I have the same issue ios 15

Add a Comment

Replies

I have the same problem. On iOS13 it's ok, only when i running on iOS14
The solution below is working for me though it's not an optimal solution:

Invoke the following method from your viewWillAppear()

Code Block
navigationController?.forceUpdateNavBar()



and create this method in UINavigationController extension
Code Block
extension UINavigationController {
func forceUpdateNavBar() {
    DispatchQueue.main.async {
        self.navigationBar.sizeToFit()
    }
  }
}

You need to use something like this:

        additionalSafeAreaInsets = UIEdgeInsets(top: 20, left: 0, bottom: 60, right: 0)
        tableView.contentInset = .zero