Change text color of status bar in iOS 9 using Objective C

In iOS 9, how can I change the color of the status bar text to white?

+147
objective-c ios9 xcode7 statusbar
Oct 13 '15 at 13:22
source share
6 answers

If you use the Reza method, the launch screen is still black.

This method is better.

  1. Go to ProjectTarget ,

  2. Set the Status Bar Style line to Light Project setting

  3. Set View controller-based status bar appearance to NO in Info.plist .

+386
Jan 24 '16 at 6:49
source share

Using the UINavigationController and set its barStyle navigation barStyle to .Black . go through this line in the file AppDelegate.m .

 navigationController.navigationBar.barStyle = UIBarStyleBlack; 

If you are not using the UINavigationController , add the following code to your ViewController.m file.

 - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } 

And call the method of this line:

 [self setNeedsStatusBarAppearanceUpdate]; 
+115
Oct 13 '15 at 13:33
source share

First set

 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 

Go to AppDelegate, find its didFinishLaunchingWithOptions method and execute:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; } 

and then set the View controller-based status bar appearance to NO in plist.

+42
Nov 14 '15 at 6:44
source share
  • Add the key to your UIViewControllerBasedStatusBarAppearance file UIViewControllerBasedStatusBarAppearance and set it to YES .

  • In the viewDidLoad method of your ViewController add a method call:

     [self setNeedsStatusBarAppearanceUpdate]; 
  • Then paste the following method into the viewController file:

     - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } 
+35
Oct 13 '15 at 2:02
source share

Add the key View controller-based status bar appearance to Info.plist and make it a boolean type set to NO .

Paste one line code into viewDidLoad (this works in a specific class where it is mentioned)

  [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; 
+11
Nov 17 '15 at 4:39
source share

The iOS status bar has only 2 options (black and white). You can try this in AppDelegate:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent]; } 
+1
Oct 13 '15 at 2:48
source share



All Articles