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 –

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

Technical Lead iOS @ONEChampionship | Ex-SDE2 @ Halodoc, Ex-iOS Lead @ Vokal. ❤️ Swift, designing pixel-perfect UI and writing clean code. Check my portfolio here.

Leave a Reply