3

In iOS8 I want to set the color of the status bar text (carrier, time, battery) to a custom color.

I've set View controller-based status bar appearance to NO and tried this code in both the individual viewcontroller, and the app delegate:

[[UINavigationBar appearance] setTintColor:color_font];

and

[self.navigationController.navigationBar setBarTintColor:[UIColor greenColor]];
Daniel Storm
  • 17,279
  • 7
  • 80
  • 145
RParadox
  • 5,545
  • 4
  • 20
  • 31

4 Answers4

2

In iOS8 I want to set the color of the status bar (Carrier, time, battery) to a custom color.

This is not possible right now without using private API (Customize iOS 7 status bar text Color). You can only make the status bar's text white (UIStatusBarStyleLightContent) or black (UIStatusBarStyleDefault). Check the docs:

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/c/tdef/UIStatusBarStyle

You can put a view behind the status bar (per everyone else's answer), but I don't think that's what you're asking.

Community
  • 1
  • 1
Aaron
  • 6,995
  • 2
  • 37
  • 52
0

try like this in your AppDelegate

UIView *addStatusBar = [[UIView alloc] init];
addStatusBar.frame = CGRectMake(0, 0, screenWidth, 20);
addStatusBar.backgroundColor = [UIColor grayColor]]; //assign here your color 
[self.window.rootViewController.view addSubview:addStatusBar];
Jogendra.Com
  • 6,228
  • 2
  • 27
  • 35
0

Goto your app info.plist

1) Set View controller-based status bar appearance to NO

Then Add Costom View on status bar in your project AppDelegate

UIView *statusBarViewObj = [[UIView alloc] init];
statusBarViewObj.frame = CGRectMake(0, 0, screenWidth, 20);
statusBarViewObj.backgroundColor = [UIColor orangeColor]];  
[self.window.rootViewController.view addSubview:statusBarViewObj];
Jugal K Balara
  • 919
  • 5
  • 15
0

Create a view, put it where the status bar will be, and set its background color to which ever color you require. For example:

Objective C:

UIView *statusBarView = [[UIView alloc]initWithFrame:CGRectMake(0, 0,
                        [UIApplication sharedApplication].statusBarFrame.size.width,
                        [UIApplication sharedApplication].statusBarFrame.size.height)];
statusBarView.backgroundColor  =  [UIColor greenColor]; // Replace with color you desire
[self.view addSubview:statusBarView];

Swift:

let statusBarView = UIView(frame: CGRectMake(0, 0,
                    UIApplication.sharedApplication().statusBarFrame.size.width,
                    UIApplication.sharedApplication().statusBarFrame.size.height))
statusBarView.backgroundColor = UIColor.greenColor() // Replace with color you desire
self.view.addSubview(statusBarView)
Daniel Storm
  • 17,279
  • 7
  • 80
  • 145