UITableView Edit Mode Show Custom Buttons

I know that people hate vague questions here, so I just need an answer of yes or no. I have a tableView and I want people to be able to edit the contents of the table.

I like the setEditing method, but I do not want the button to say Delete - I would prefer Delete, and there are times when I want to display more than one button and hide the delete button. I just need to know if this is possible.

I’m ready to abandon the use of the standard edit and delete buttons and just make my own, but before that I wanted to know what was possible.

Thanks a lot Cheryl

+6
iphone xcode uitableview
source share
2 answers

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html

Just implement this method in a UITableViewDelegate:

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

You can then set the title for this delete button and make it say β€œDelete” instead.

+9
source share

As Kenny remarked, you can use tableView: titleForDeleteConfirmationButtonForRowAtIndexPath: a method for changing the name of the delete button. If you want to use a different button in general, use the UITableViewCell editingAccessoryView property to change the view displayed in edit mode.

+1
source share

All Articles