Search code examples
stylesios10statusbar

How to allow UIView lie under status bar in iOS 10?


How to allow UIView lie under status bar like on the picture below?

enter image description here


Solution

  • Originally answered here.

    If you're using Safe Area Layout Guides you can do this completely in Interface Builder.

    enter image description here

    Pin the view you want under the status bar to the main view using the Top Space to Container Margin constraint instead of Top Space to Safe Area constraint.

    Then on the Size Inspector for the main view, uncheck Safe Area Relative Margins.

    enter image description here