0
votes

I want to create a status bar with a black opaque background and white text. To do this I did the following:

  1. In my .plist set the "UIViewControllerBasedStatusBarAppearance" to "NO"
  2. In my .plist set the "UIStatusBarStyle LightContent" to "UIStatusBarStyleLightContent"
  3. Create an UIView in my storyboard with the following constraints:

Status bar UIView

Now I have a status bar with white text and an opaque background, like this (Ignore the background picture): Status Bar

However when I scroll, the UIView background won't stick underneath the statusbar, for example:

Status bar without a BG

This probably has to do with the vertical constraint, which should link to the top layout guide instead of the superview, but this constraint is not showing in xcode and I have no idea what else could be wrong.

1
Your background image is in a scrollview? Is the background image suppose to be scrollable?JingJingTao
Yes the background image is in a scrollview, and its supposed to be scrollableHapeki
so you don't want the content to go under the status bar? Thanks for the video. Do you want the status bar to have a solid background color?JingJingTao

1 Answers

1
votes

Update:

Solved in chat, just needed to put the opaque view in front of the scrollview and not have it as a subview of the scrollview.

You could turn bounces off for the scrollview, but this doesn't look as smooth.enter image description here