1

I already googled a little bit but without success. I want to have a custom background color for the status bar in all my ViewControllers (only in portrait mode). The ViewControllers are managed with a TabBarController.

Does anybody know how to do that? Maybe anybody has a code sample?

2

2 Answers 2

1

I already solved the problem myself by putting a UIView below the Status bar and set the background color. But I had to clear all constraints and add them again to make the UIView hiding in landscape mode.

Sign up to request clarification or add additional context in comments.

Comments

0

Try this, it will help.

let demoView = UIView()
demoView.frame = CGRectMake(0, 0, 320, 22)
demoView.backgroundColor = UIColor.redColor()
self.view.addSubview(demoView)

6 Comments

I put it in didFinishLaunchingWithOptions in AppDelegate.swift, right?
I get: Value of type 'AppDelegate' has no member 'view'. What does it mean?
Put it inside the viewDidLoad () of your view controller.
This it what I'm getting: fs5.directupload.net/images/160606/wm3f9vmo.jpg Something seems to be wrong.
Instead of 320 use self.view.frame.size.width
|