How to change iPhone UITableView delete button title while editing it How to change iPhone UITableView delete button title while editing it ios ios

How to change iPhone UITableView delete button title while editing it


You can change it in UITableView delegate method

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath


Swift

Add this method to your UITableView delegate (probably your view controller).

func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {    return "Erase"}

This makes the button say "Erase" but you can use any string you want.

enter image description here

My fuller answer is here.


Swift 3

With a small difference _

func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {    return "Erase"}