Here this code works and the color of the navigationbar changed to blue
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Countries"
navigationController?.navigationBar.barTintColor = UIColor.blue
tabBarController?.tabBar.tintColor = UIColor.white
view.backgroundColor = .white
}
BUT WHEN adding navigationController?.navigationBar.prefersLargeTitles = true
color does not change
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Countries"
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationBar.barTintColor = UIColor.blu
tabBarController?.tabBar.tintColor = UIColor.white
view.backgroundColor = .white
}
Here you can use [navigationBar.backgroundColor] instead off [navigationBar. barTintColor]
navigationItem.title = "Countries"
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationBar.backgroundColor = UIColor.blue
tabBarController?.tabBar.tintColor = UIColor.white
view.backgroundColor = .white
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.