title: iOS 8 Swift Xcode 6 - Set top nav bar bg color and height
body: <p>I have looked everywhere and tested all the code snippets posted on Stack, but nothing works for me as I need it to work.</p>
  
  <p>I simply want to set:</p>
  
  <ul>
  <li>Nav bar height</li>
  <li>Nav bar bg color in RGB</li>
  <li>Nav bar centered logo</li>
  </ul>
  
  <p>I'm working with iOS8, Xcode 6 and Swift.</p>
  
  <p>Many thanks for a clear answer!</p>
  
  <p>This is my code in ViewController.swift</p>
  
  <pre><code>// Set nav bar height
  
      navigationController?.navigationBar.frame.origin.y = -10
  
      // Set nav bar bg color
  
      var navBarColor = UIColor(red: 4 / 255, green: 47 / 255, blue: 66 / 255, alpha: 1)
  
      navigationController?.navigationBar.barTintColor = navBarColor
  
      // Set nav bar logo
  
      let navBarImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
  
      navBarImageView.contentMode = .ScaleAspectFit
  
      let navBarImage = UIImage(named: "navBarLogo.png")
  
      navBarImageView.image = navBarImage
  
      navigationItem.titleView = navBarImageView
  </code></pre>