How to get a transparent status bar like the image shown below?

Viewed 3905

enter image description here

I need a transparent status bar as shown in the image below.

I tried this,

UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];

if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
    statusBar.backgroundColor = [UIColor clearColor];
}

But this basically gives the same result as UIStatusBarStyleLightContent.

2 Answers

For anyone trying to get the imageView to go up into the "ears" of the "notch," make sure to select the imageView and its superView and set their top constraints to zero. The Interface Builder does not default the view into the notch's ears. It will have a top-layout-constraint (below the Status Bar) as default.

Related