I'm displaying an editButtonItem in my tableview but I need to change the text of Edit and Done to Change and Cancel. All the examples I've found so far are in Objective-C... I need Swift syntax.
I have the following in viewDidLoad function...
self.navigationItem.leftBarButtonItem = self.editButtonItem()
... which displays the standard Edit/Done button item.
you want to work on setEditing
method
override func setEditing (editing:Bool, animated:Bool)
{
super.setEditing(editing,animated:animated)
self.editButtonItem.title = editing ? "Cancel" : "Change"
}
and add the following line in viewDidLoad()
self.navigationItem.leftBarButtonItem!.title = "Change"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With