Search code examples
iosswiftuinavigationcontrolleruinavigationbaruistatusbar

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


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.


Solution

  • 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.

    enter image description here