Search code examples
swiftiphonestoryboardios11xcode9

UIStoryBoard - Prevent View from overlapping status bar (iOS 11 App)


I want to stop overlapping of my View with statusbar

enter image description here


Solution

  • Use Auto Layout and pin your view to Top Layout Guide, or use the new Safe Area Layout Guides. To enable it, in your storyboard's File inspector tick the following option.

    enter image description here

    As an example I have used gray image view:

    enter image description here

    As you can see below, it does not overlap status bar:

    enter image description here