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!
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.
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 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.
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.
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.
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!
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.
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With