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.
By default, status bar has transparent background, you just need to extend frame of your image, behind status bar.
Here is test snapshot for you. I've set UIImageView with red background color and custom image.
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.
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