Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Status Bar Text Color iOS 7 [duplicate]

I am unable to change the text colour in the status bar in iOS 7 SDK. Currently its black and i want it to be white for all my view controllers in a storyboard.

I have seen few questions on StackOverflow like THIS, THIS and THIS but they didn't of much help. Also may be due to the fact that i am unable to find UIViewControllerBasedStatusBarAppearance to YES in my plist file.

Can any one tell me the right way to set the status bar text colour to white for all view controllers in the storyboard? Thanks in advance!

like image 718
AJ112 Avatar asked Sep 28 '13 08:09

AJ112


People also ask

How do I change the color of my status bar on my Iphone?

Go to the Storyboard. Select the View and in the Attributes Inspector change the Background Color to Light Gray. Build and Run the Project. The default style of the status bar is dark content.

How do I change the color of my status bar text?

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.

How to change status bar text color Flutter?

Step 1: Locate the MaterialApp widget. Step 2: Inside the MaterialApp, add the theme parameter with ThemeData class assigned. Step 3: Inside the ThemeData add the appBarTheme parameter and then assign the AppBarTheme class. Step 4: Inside the AppBarTheme , specify the systemOverlayStyle parameter and set the color.

How do I change the color of text in status bar in Objective C?

Go to Project -> Target , Then set Status Bar Style to Light . It makes status-bar white from the launch screen. Then set View controller-based status bar appearance equal to NO in Info.


2 Answers

Let me give you a complete answer to your question. Changing the status bar text colour is very easy but its a little confusing in iOS 7 specially for newbies.

If you are trying to change the colour from black to white in StoryBoard by selecting the view controller and going to Simulated Metrics on the right side, it won't work and i don't know why. It should work by changing like this but any how.

Secondly, you won't find UIViewControllerBasedStatusBarAppearance property in your plist but by default its not there. You have to add it by yourself by clicking on the + button and then set it to NO.

ios 7 status bar text color

Lastly, you have to go to your AppDelegate.m file and add the following in didFinishLaunchingWithOptions method, add the following line:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 

This will change the colour to white for all your view controllers. Hope this helps!

like image 65
KC. Avatar answered Sep 25 '22 12:09

KC.


If you're looking for UIViewControllerBasedStatusBarAppearance, you'll need to click the little plus sign that appear when you hover over the root element in your plist file.

plist file

Once you do that, a new row will appear - select "View controller-based status bar appearance" from the dropdown list and set NO as its value. (That friendly name is declared internally as UIViewControllerBasedStatusBarAppearance)

Next, calling the following method in your app delegate should set the status bar color to white for all view controllers:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 
like image 37
AbdullahC Avatar answered Sep 21 '22 12:09

AbdullahC