Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming the "Delete" button in edit mode of tableviewcontroller

Can we rename the "Delete" button when put a table view in edit mode to something else?

like image 602
Abhinav Avatar asked Dec 19 '11 19:12

Abhinav


3 Answers

The UITableView delegate just has to implement:

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
like image 195
amattn Avatar answered Oct 15 '22 14:10

amattn


Implement

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

And return your custom title for delete.

From UITableViewDelegate docs

like image 5
Alex Terente Avatar answered Oct 15 '22 15:10

Alex Terente


In Swift:

override func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {
        return "Remove"
    }
like image 1
Farshid Avatar answered Oct 15 '22 15:10

Farshid