Mych Mych - 1 year ago 105
Swift Question

How to change Edit/Done button title in UINavigationBar in Swift

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)
        self.editButtonItem().title = "Cancel"
        self.editButtonItem().title = "Change"