In iOS7 , is it possible to change status bar foreground(text, elements) colour to something other than white or black, without using any private API's?
-
http://stackoverflow.com/questions/19063365/how-to-change-the-status-bar-background-color-and-text-color-on-ios-7 – iBhavin Aug 05 '14 at 06:57
-
You can set status bar in black or white colour, I don't think there is other way. https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/Bars.html – Kampai Aug 05 '14 at 08:26
2 Answers
Did you tried this :
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
EDIT :
I tried this, it worked for me :
In your AppDelegate.m
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
In your AppDelegate.m application:didFinishLaunchingWithOptions:
method
[self.yourNavigationController.navigationBar setBarTintColor:UIColorFromRGB(0x067AB5)];
from here

- 1
- 1

- 2,357
- 4
- 26
- 44
If you want the to set the color of the text and content in the status bar throughout the entire app you have two options. First, you can set the UIStatusBarStyle key in your Info.plist to UIStatusBarStyleLightContent or UIStatusBarStyleDefault. Second, you can use the UIApplication method setStatusBarStyle:animated:. In order to use this method you must set the UIViewControllerBasedStatusBarAppearance key in your Info.plist to NO. It is worth noting that this method of changing the UIStatusBarStyle app-wide can be done while the app is running. Below is an example of how to use this method.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
If you want to change the color of the text and content in the status bar on a view-by-view basis you can take advantage of a new UIViewController method. To use this method you must set the previously mentioned UIViewControllerBasedStatusBarAppearance key in your Info.plist to YES. Below, I have demonstrated how this new method, preferredStatusBarStyle, can be overridden to adjust the color of the content in the status bar.
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
Source: http://www.doubleencore.com/2013/09/developers-guide-to-the-ios-7-status-bar/
EDIT: (Don't know whether this is still possible in iOS7)
There is no direct way of changing the Status Bar color. We can just choose the status bar style using the “setStatusBarStyle” property and choose among the three available styles which are -
UIStatusBarStyleDefault UIStatusBarStyleBlackTranslucent UIStatusBarStyleBlackOpaque However if you would like to change the color of status bar, there is a trick which can do the same -
Change the background color of your UIWindow object. And set the status bar style to “UIStatusBarStyleBlackTranslucent”. This will set the color of status bar same as the background color of the window.
Add the following code to your AppDeligate.m file in the applicationDidFinishLaunchingWithOptions -
self.window.backgroundColor = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1];
[application setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
You may change the RGB color values as per your need.
Source: http://beageek.biz/how-to-change-background-color-status-bar-xcode-ios/

- 1,025
- 6
- 23
-
This changes status bar foreground colour to white. I know this. What i want to know wether its possible to change colour to something other than white or black. Say for example 'Blue' – Waruna Aug 05 '14 at 08:20