当用户滑动单元格时,我使用以下代码显示删除按钮tableview
。我想在这个按钮中写取消而不是删除,我怎样才能实现这个功能?
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
和
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//remove the deleted object from your data source.
//If you're data source is an NSMutableArray, do this
[self.dataArray removeObjectAtIndex:indexPath.row];
}
}