UITableView Edit Mode Show Custom Buttons
I know that people hate vague questions开发者_Go百科 here so I just need a yes or no answer. 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 don't want the button to say Delete - I would prefer Remove and there are times where I want to display more than one button and hide the delete button. I just need to know if this is possible.
I am ready to give up on using the standard edit and delete buttons and just make my own but before I did I wanted to know what was possible.
Thanks very much Cheryl
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html
Just implement this method on your UITableViewDelegate:
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
Then you can set the title for that delete button and make it say "Remove" instead.
As Kenny pointed out, you can use the tableView:titleForDeleteConfirmationButtonForRowAtIndexPath: method to change the title of the delete button. If you want to use a different button altogether, use UITableViewCell's editingAccessoryView property to change the view shown in editing mode.
精彩评论