title: Insert right button image in UINavigationController with swift 3
body: <p>I'm trying to override programmatically the rightButton of a navigation item with a static image in order to achive this:</p>
  
  <p><a href="https://i.stack.imgur.com/yPDNz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yPDNz.png" alt="enter image description here"></a></p>
  
  <p>The following code does not give any errors but nothing is displayed in the navigation bar.</p>
  
  <pre><code>import UIKit
  import Foundation
  class UICipNavigationController: UINavigationController {
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  
      // Add BPT LOGO as UIBarButton
      let logoBPT = UIImage(named: "Logo BPT")?.withRenderingMode(.alwaysOriginal)
  
      let logoBPTBarButton = UIBarButtonItem(image: logoBPT, style: .plain, target: nil, action: nil)
      self.navigationItem.rightBarButtonItem = logoBPTBarButton
  
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  }
  </code></pre>
  
  <p>.   </p>
  
  <pre><code>import UIKit
  
  class UICipNavigationBar: UINavigationBar {
  
  override init(frame: CGRect){
      super.init(frame: frame)
  
  }
  
  required init?(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)!
  
      self.tintColor = UIColor.white
  
      self.setBackgroundImage(UIImage.fromColor(color: UIColorFromHex(rgbValue: 0xffffff, alpha: 0.2)), for: UIBarMetrics.default)
      self.shadowImage = UIImage()
      self.isTranslucent = true
      self.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont(name: "Lato-Regular", size: 24)!]
  
  }
  
  override func sizeThatFits(_ size: CGSize) -&gt; CGSize {
      let newSize :CGSize = CGSize(width: self.superview!.bounds.size.width, height: 60)
      return newSize
  }
  
  }
  </code></pre>
  
  <p>I also tried to inspect the views but it seems that nothing is added:</p>
  
  <p><a href="https://i.stack.imgur.com/I7GOo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I7GOo.png" alt="enter image description here"></a></p>