Change status bar text color to light in iOS 9 with Objective-C

Objective CIos9Xcode7Statusbar

Objective C Problem Overview


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

Objective C Solutions


Solution 1 - Objective C

If you want to change Status Bar Style from the launch screen, You should take this way.

  1. Go to Project -> Target,

  2. Set Status Bar Style to Light Project Setting

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

Solution 2 - Objective C

Using a UINavigationController and setting its navigation bar's barStyle to .Black. past this line in your AppDelegate.m file.

navigationController.navigationBar.barStyle = UIBarStyleBlack;

If you are not using UINavigationController then add following code in your ViewController.m file.

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

And call the method to this line :

[self setNeedsStatusBarAppearanceUpdate];

Solution 3 - Objective C

First set

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

Go to your AppDelegate, find itsdidFinishLaunchingWithOptions method and do:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

}

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

Solution 4 - Objective C

  1. Add a key in your info.plist file UIViewControllerBasedStatusBarAppearance and set it to YES.

  2. In viewDidLoad method of your ViewController add a method call:

     [self setNeedsStatusBarAppearanceUpdate];
    
  3. Then paste the following method in viewController file:

     - (UIStatusBarStyle)preferredStatusBarStyle
     { 
         return UIStatusBarStyleLightContent; 
     }
    

Solution 5 - Objective C

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

Insert one line code in viewDidLoad (this works on specific class where it is mentioned)

 [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

Solution 6 - Objective C

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];
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionreza_khalafiView Question on Stackoverflow
Solution 1 - Objective CWanbok ChoiView Answer on Stackoverflow
Solution 2 - Objective CJay BhalaniView Answer on Stackoverflow
Solution 3 - Objective Creza_khalafiView Answer on Stackoverflow
Solution 4 - Objective CVijay YadavView Answer on Stackoverflow
Solution 5 - Objective CManinderjit SinghView Answer on Stackoverflow
Solution 6 - Objective Casim.temurView Answer on Stackoverflow