4

So, I'm trying to make this:

enter image description here

i tried using UIView in back of Status bar and set the color to orange, but when running, The UIView displayed right under the status bar, so it's still White

i'm trying many solution in the internet but none of them work. Yes it works but when i move to other view controller and back again, The color dissapeared. What should I do? i'm using swift

5
  • Can you add a code example of what you are running? Also which version of swift and ios are you using? Commented Jun 15, 2016 at 9:21
  • 1
    stackoverflow.com/questions/19063365/… Commented Jun 15, 2016 at 9:25
  • You have to make your UIView in fullscreen. Commented Jun 15, 2016 at 9:25
  • stackoverflow.com/questions/21180173/… Commented Jun 15, 2016 at 9:57
  • thanks @luiyezheng that works for me :D Commented Jun 17, 2016 at 3:07

1 Answer 1

21
UIApplication.shared.statusBarStyle = .lightContent

UINavigationBar.appearance().clipsToBounds = true

let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView

statusBar.backgroundColor = UIColor.orange

Try using this code in your appDelegate's method application didFinishLaunchingWithOptions

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

1 Comment

There is an issue with this solution, when you double press the home button, this status status bar color will disappear. like the question(stackoverflow.com/questions/47250495/…)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.