iOS Changing the status bar style for the entire application


Example


SWIFT:


Step 1:

In your Info.plist add the following attribute:

View controller-based status bar appearance

and set its value to

NO

as described in the image below:

enter image description here

Step 2:

In your AppDelegate.swift file, in didFinishLaunchingWithOptions method, add this code:

UIApplication.shared.statusBarStyle = .lightContent

or

UIApplication.shared.statusBarStyle = .default
  • The .lightContent option will set the colour of the statusBar to white, for the entire app.

  • The .default option will set the colour of the statusBar to the original black colour, for the entire app.


OBJECTIVE-C:


Follow the first step from the SWIFT Section. Then add this code to the AppDelegate.m file:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

or

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];