user1416564 user1416564 - 1 year ago 104
iOS Question

iOS 8 make statusbar black and not translucent

So my status bar in my app currently looks like this:


And I'd rather it look something like this:


So that it's black with white text. At the moment it doesn't work on this particular screen because the background isn't black. And I've already set the

Status Bar Style
in the pList to

I'll also add that the View is the initial ViewController AND it doesn't have a
embedded into it:

EDIT: This is not a duplicate because most of the other previous solutions are outdated already.

Answer Source

You can just set it to light and then toss a view behind it. You'll also have to account for device rotation if you allow that in your app.

override func viewDidLoad() {

    let statusBG = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 21))
    statusBG.backgroundColor = UIColor.blackColor()


- (void)viewDidLoad {
    [super viewDidLoad];
    UIView *statusBG = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 21)];
    statusBG.backgroundColor = [UIColor blackColor];
    [self.view addSubview:statusBG];