title: iOS Custom Status Bar Background Color not displaying
body: <p>I am trying to fill the status bar background color to orange using the following</p>
  
  <pre><code>UINavigationBar.appearance().tintColor = UIColor.orangeColor()
  UINavigationBar.appearance().barTintColor = UIColor.orangeColor()
  UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
  UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
  </code></pre>
  
  <p>However, I get a white status bar that should be filled with orange instead from following this example: <a href="https://coderwall.com/p/dyqrfa/customize-navigation-bar-appearance-with-swift" rel="noreferrer">Customize navigation bar appearance with swift</a> </p>
  
  <p>I am setting this up in the <strong>AppDelegate.swift</strong> file under <strong>didFinishLaunchingWithOptions</strong> method to apply it to the entire app. </p>
  
  <p>I have edited my <strong>info.plist</strong> to the following: <strong><code>View controller-based status bar appearance =&gt; NO</code></strong> </p>
  
  <p>Does anyone know what I am doing wrong?</p>
  
  <p>Edit: I'm not sure if it matters but the view is in a <strong>UITabBarController</strong> </p>
  
  <p>Edit 2: This is happening in all the views actually, not just the <strong>UITabBarController</strong>.</p>
  
  <p>Edit 3: Thanks <em>@Utsav</em> Parikh  </p>
  
  <p>I am adding a view now on top of the status bar and it for a brief moment while the app loads the status bar is orange but, once it finishes loading it gets pushed OFF the view and replaced with the generic white status bar. 
  Why would this be happening?</p>
  
  <pre><code>let view = UIView(frame: CGRect(x: 0.0, y: 0.0, width: UIScreen.mainScreen().bounds.size.width, height: 20.0))
  view.backgroundColor=UIColor.orangeColor()
  self.window!.rootViewController!.view.addSubview(view) 
  </code></pre>
  
  <p>Edit for <strong>Swift 3</strong>:</p>
  
  <p>with <strong>UITabBarController</strong></p>
  
  <pre><code>let view = UIView(frame: CGRect(x: 0.0, y: 0.0, width: UIScreen.main.bounds.size.width, height: 20.0))
  view.backgroundColor = .orange
  self.view.addSubview(view)
  </code></pre>
  
  <hr>
  
  <p><strong>Without embedded controllers</strong></p>
  
  <p>I realize some people come here not only for the status bar, but actually the navigation bar, so I learned a few tricks along the way to do it without any embedded controllers:</p>
  
  <p>Add this method in your <strong>AppDelegate.swift</strong> and call it in the <strong>didFinishLaunchingWithOptions</strong></p>
  
  <pre><code>func customizeAppearance() {
      UINavigationBar.appearance().barTintColor = UIColor.black
      UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
      UITabBar.appearance().barTintColor = UIColor.black
      let tintColor = UIColor(red: 255/255.0, green: 255/255.0, blue: 255/255.0, alpha: 1.0)
  
      UITabBar.appearance().tintColor = tintColor
  }
  </code></pre>