Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set status bar style to light content on iOS7?

Tags:

xcode

ios7

I tried several solutions from SO for this problem but none of them worked for me. I created a new iOS7 project with one simple view. I tried setting

View controller-based status bar appearance to NO

and in AppDelegate:

[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];

However this removes the status bar completely.

Without the View controller-based status bar appearance option, Regardless what I set for Status bar style in the plist file, the status bar text is still black. I need it to be white for the entire application. Is this possible?

I am on latest xcode version.

like image 891
UpCat Avatar asked Mar 20 '14 20:03

UpCat


People also ask

How can I change the color of my status bar?

Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar. Step 3: In your MainActivity, add this code in your onCreate method.

How do I set my status bar?

To customize it, first pull down the slider bar from the top of the screen. Next, tap on the three vertical dots in the top right corner. Now click on Status bar. You're in.


2 Answers

did you try it without "Animated:No" ?

Go to Info tab of the project target, Add Row:

UIViewControllerBasedStatusBarAppearance, set value NO

Then in appdelegate.m

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

[application setStatusBarStyle:UIStatusBarStyleLightContent];
}

This should set it application wide.

like image 66
Obj-Swift Avatar answered Oct 11 '22 14:10

Obj-Swift


The Accepted answer seemed to work sometimes. I found out that the UIViewController can change the status bar style also. To get around this and always work, cause I didn't need the UIViewControllers controlling the status bar, I had to set UIViewControllerBasedStatusBarAppearance to NO in my Info.plist

like image 27
smitt04 Avatar answered Oct 11 '22 12:10

smitt04