Mr Li Mr Li - 28 days ago 21
iOS Question

Swift setting navigation background image,

class z_main:UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

let mainColor = UIColor(red: 0, green: 160/255, blue: 1, alpha: 1)
self.navigationController?.navigationBar.backgroundColor = mainColor
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
self.title = "baosight"
self.reloadInputViews()



}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}


I am beginner ,I hope the code is enough for understanding.

Answer
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: "some_name"), 
                                               forBarMetrics: .Default)