I am trying to change the tint color of a UIBarButtonItem. I change the tintColor property when the user makes a selection and it works just fine, but only while the user is on the current screen. Once the user pushes a new view controller onto the stack the change doesn't persist. When they go back to the screen the changed tintColor is back to the original. I have tried resetting the property in viewWillAppear and viewDidAppear. Still nothing. If someone could explain to me what is happening is it would be greatly appreciated! Thank you.
@IBOutlet var dataRunNameBtn: UIBarButtonItem!
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
updateUI()
}
private func updateUI() {
equationType.text = EquationCalculator.sI.equationType
formulaForEquation.text = EquationTableDataSource.sI.formulaText!
self.dataRunNameBtn.title = ClipBoardModel.sI.currentDataRun.name
// Clipboard
if ClipBoardModel.sI.currentDataRunComputed {
self.dataRunNameBtn.tintColor = UIColor.greenColor()
} else {
self.dataRunNameBtn.tintColor = UIColor.flatSandColor()
}
}