Search code examples
iosswiftuikit

iOS14 navigation bar being ignored by viewController inner View which is overlapping it


I have a UINavigationController with some UIViewControllers embed. The problem is when I start to push viewControllers. As you can see in the next image, the content view of the current viewController is overlapping the navigationBar:

enter image description here

enter image description here

In viewDidLoad:

 func setupFront() {
        navigationController?.setNavigationBarHidden(false, animated: true)
        self.navigationController?.navigationBar.prefersLargeTitles = true
        title = NSLocalizedString("customer_settings_profile_title", comment: "")
        binding()
        setupLanguage()
    }

Solution

  • The problem was the autolayout. The top constraints of the views that I push weren't set to safe area.

    Now it is and it works:

    enter image description here