iosswiftuinavigationbarios11iosdeployment

iPhone 8: view doesn't hide under the Navigation bar


I have searched all the questions and mostly developers are asking how to solve issue where view is hiding behind navigation bar, on the other hand I want to hide my view behind the navigation bar but had no luck.

I have a tableview and I want that to start from behind navigation bar.

I have tried following so far.

    self.navigationController?.navigationBar.isTranslucent = true
    self.extendedLayoutIncludesOpaqueBars = true
    self.edgesForExtendedLayout = .top

But no luck, I also tried enabling via storyboard but that also didn't do a thing.

Adding screenshot

enter image description here

This is NavBar's inspecter, enter image description here

This is what it's showing,

enter image description here

We can cell starts right after the bar.

Cell Hierarchy, enter image description here


Solution

  • The key thing is how you pin the top of your view. It must be pinned to the top of the main view — not the top main view margin, not the safe area / top layout guide. Look carefully at this screen shot: this is how your top constraints must look:

    enter image description here

    When the app runs, the view underlaps the navigation bar, just as shown in Interface Builder:

    enter image description here