I have declared two UIBarButtonItem, btnEdit and btnSave. initially i'm setting btnEdit in viewDidLoad. if user taps on btnEdit i want to set btnSave as rightBarButtonItem and when tapped on btnSave, set btnEdit as rightBarButtonItem.
it is working fine and i'm able to tap on it but after first tap button is faded/ not in highlighted state. Images Attached. How do i make it have normal State?
var btnEdit : UIBarButtonItem!
var btnSave : UIBarButtonItem!
@objc func btnEditTapped (){
textFieldViewNote.isEditable = true
navigationItem.rightBarButtonItem = btnSave
}
@objc func btnSaveTapped (){
textFieldViewNote.isEditable = false
navigationItem.rightBarButtonItem = btnEdit
}
override func viewDidLoad() {
super.viewDidLoad()
btnSave = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(btnSaveTapped))
btnEdit = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(btnEditTapped))
navigationItem.rightBarButtonItem = btnEdit
}
After loading VC - Edit in normal state