如何在交换事件上更改UITableCell中删除按钮的文本

时间:2011-05-19 07:55:04

标签: ios objective-c cocoa-touch

我已经实现了在交换时显示删除按钮的功能,它还通过单击按钮删除了单元格。但我只想将删除按钮的文本从“删除”更改为“取消”

2 个答案:

答案 0 :(得分:11)

UITableViewDelegate中实施以下内容:

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
    return @"Cancel";
}

答案 1 :(得分:4)

您可以使用UITableViewDelegate协议方法:

tableView:titleForDeleteConfirmationButtonForRowAtIndexPath: