So my status bar in my app currently looks like this:
And I'd rather it look something like this:
2 http://mojoimage.com/free-image-hosting-12/22iOS7_StatusBar-copy.png
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 UIStatusBarStyleLightContent
.
I'll also add that the View is the initial ViewController AND it doesn't have a UINavigationController
embedded into it:
EDIT: This is not a duplicate because most of the other previous solutions are outdated already.
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.
Swift:
override func viewDidLoad() {
super.viewDidLoad()
let statusBG = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 21))
statusBG.backgroundColor = UIColor.blackColor()
view.addSubview(statusBG)
}
Objective-C:
- (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];
}