How To Change the Background Color of Status Bar – XCode iOS

There is no direct way of changing the Status Bar color. We can just choose the status bar style using the “setStatusBarStyle” property and choose among the three available styles which are –

  • UIStatusBarStyleDefault
  • UIStatusBarStyleBlackTranslucent
  • UIStatusBarStyleBlackOpaque

However if you would like to change the color of status bar, there is a trick which can do the same –

Change the background color of your UIWindow object. And set the status bar style to “UIStatusBarStyleBlackTranslucent”. This will set the color of status bar same as the background color of the window.

Add the following code to your AppDeligate.m file in the applicationDidFinishLaunchingWithOptions –

1
2
self.window.backgroundColor = [UIColor colorWithRed:0.78f green:0.13f blue:0.11f alpha:1];
[application setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

You may change the RGB color values as per your need.

Namit Gupta

iOS Developer @GetVokal. Passionate about Mobile Apps. Loves to Design. You can reach him on his social profiles below.

Leave a Reply