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()
}
}
我是初学者,我希望代码足够理解。
答案 0 :(得分:2)
对于Swift 3:
.csproj
答案 1 :(得分:0)
[UINavigationBar .appearance().setBackgroundImage(UIImage(named: "img_bg"), forBarMetrics:.Default)];
答案 2 :(得分:0)
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: "some_name"),
forBarMetrics: .Default)