title: Set Status bar color - delay?
body: <p>When ill try to change the text-color of me StatusBar in iOS, there is always a delay for maybe 1-2 seconds. So it starts with black, and after that delay its getting white, as i want to.</p>
  
  <p>All these changes are in my ViewController, in ViewDidLoad.</p>
  
  <p>Ill use a custom view to get an specific color:</p>
  
  <pre><code>    let statusBarHeight = CGFloat(20)
      let colorBGView = UIView(frame: CGRectMake(0, -statusBarHeight, self.view.bounds.width, statusBarHeight))
      colorBGView.backgroundColor = UIColor.customDarkerGrey()
      self.navigationController?.navigationBar.addSubview(colorBGView)
  </code></pre>
  
  <p>And set the barStyle to Black (to get the white color font when using an UINavigationController)</p>
  
  <pre><code>    self.navigationController?.navigationBar.barStyle = UIBarStyle.Black
  </code></pre>
  
  <p>Set the Value for: </p>
  
  <pre><code> View controller-based status bar appearance
  </code></pre>
  
  <p>In the plist.info to "YES"</p>
  
  <p>But there is still a "lag" - so everything is white, but it takes up to 2 seconds. Any ideas?</p>
  
  <p>Ill found not an answer question, because this is only about coloring, not for the problem with the delay:</p>
  
  <p><a href="https://stackoverflow.com/questions/19022210/preferredstatusbarstyle-isnt-called/19513714#19513714">preferredStatusBarStyle isn&#39;t called</a></p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Ok, after creating a new Project with 2 ViewControllers and a NavigationController ill found out, that the "Delay" is normal, when you try to change the Color from ViewController to ViewController. It seems, that the function:</p>
  
  <pre><code>override func preferredStatusBarStyle() -&gt; UIStatusBarStyle {
      return UIStatusBarStyle.LightContent
  }
  </code></pre>
  
  <p>Is called with a little delay - and nothing happens when ill add:</p>
  
  <pre><code>self.setNeedsStatusBarAppearanceUpdate()
  </code></pre>
  
  <p>So in my case ill changed it globally on the NavigationController, and (because its loaded with my App) you do not recognize the "delay". </p>
  
  <p>Maybe this is helpful for someone else.</p>