How to allow UIView lie under status bar like on the picture below?
Originally answered here.
If you're using Safe Area Layout Guides you can do this completely in Interface Builder.
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.
Just make sure that you've set your top space constraint
equals 0 to your superview
, not to the Bottom Layout Guide
in the Storyboard.
In order to make status bar style like in the screenshot (white text, transparent background) you may want to set it's style
to .lightContent
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With