Krunal Krunal - 1 year ago 173
iOS Question

Unable to change the status bar background color color on iOS 7

I want to change background color of status bar in iOS 7,

Here is my code snippet:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
[UIApplication sharedApplication].statusBarHidden = NO;

self.window.clipsToBounds = YES;
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent];
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);



When i write this it shows Status bar with black background i want it with red background

How to change color of status bar with red background instead of black ?

Answer Source

in iOS 7 the status bar is transparent. Set the backgroundColor of your View to Red Color.

or you have to add 20px-high subview with red color on your view.

See Apple Transition Guide

Also make sure that your preferredStatusBarStyle is UIStatusBarStyleLightContent. and in info.plist Set View controller-based status bar appearance to NO

Hope it will help you..Enjoy coding..!!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download