Search code examples
layoutscrollviewios10ios11

Ios Navigation bar spacing


I'm trying to place a scrollview such as the top of the view will be right below the navigation bar. I noticed that I have 2 different behavior on ios 10 and 11+.

On the image below, ios10 is on the right. Here's a link to the code: https://github.com/floriel-fedry-cko/ios-scrollview.

Is there a way to fix it to have the same behavior on both?

ios 10 and 11


Solution

  • Set Navigation Bar's translucent property to false. You can set it in code and storyboard both.

    self.navigationController?.navigationBar.isTranslucent = false
    

    enter image description here