Try this code:
Note: Code Tested in Swift 3.
In ViewController A:
override var isViewLoaded: Bool {
title = "View 1"
navigationController?.navigationBar.barTintColor = .blue
navigationController?.navigationBar.isTranslucent = true
navigationController?.navigationBar.tintColor = UIColor.white
navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]
UIApplication.shared.statusBarStyle = .lightContent
self.navigationController?.navigationBar.barStyle = .black // In case statusbar Light content wont work.
return true
}
In ViewController B:
override var isViewLoaded: Bool {
title = "View 2"
navigationController?.navigationBar.barTintColor = .green
navigationController?.navigationBar.tintColor = .white
navigationController?.navigationBar.isTranslucent = true
navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]
return true
}
Output: No delay what so ever...
Pattern Image as a TintColor.
In ViewController A:
navigationController?.navigationBar.barTintColor = UIColor(patternImage: UIImage(named: "viewOneImage.jpg")!)
In ViewController B:
navigationController?.navigationBar.barTintColor = UIColor(patternImage: UIImage(named: "viewTwoImage.jpg")!)
Output:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…