title: swift: setting back button image in nav bar
body: <p>I'm trying to set the back button image in nav bar in my controller, here's my code in viewDidLoad():</p>
  
  <pre><code>        var backImg: UIImage? = UIImage(named: "back_btn.png")
      println(backImg)
      if var back_img = backImg  {
          println("GET IT")
          println(back_img)
          println(UIControlState.Normal)
          println(UIBarMetrics.Default)
      self.navigationController.navigationBar.backItem.backBarButtonItem.setBackButtonBackgroundImage(back_img, forState: UIControlState.Normal, barMetrics: UIBarMetrics.Default)
      }
  </code></pre>
  
  <p>I tried to put them to viewWillLoad, but getting the same error</p>
  
  <p>Console with error message:</p>
  
  <pre><code>&lt;UIImage: 0x7ff37bd85750&gt;
  GET IT
  &lt;UIImage: 0x7ff37bd85750&gt;
  VSC14UIControlState (has 1 child)
  (Enum Value)
  fatal error: unexpectedly found nil while unwrapping an Optional value
  </code></pre>
  
  <p>I don't know which part went wrong. Seems like the back_img is not nil, but I got error saying it's nil</p>
  
  <p>Thanks!</p>