只需要实现三个代理方法就可以了
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == _BarCodeTableView) {
return @"删除";
}
return @"";
}
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCellEditingStyle result = UITableViewCellEditingStyleNone;//默认没有编辑风格
if ([tableView isEqual:_BarCodeTableView]) {
result = UITableViewCellEditingStyleDelete;//设置编辑风格为删除风格
}
return result;
}
//这里就是点击删除执行的方法
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == _BarCodeTableView) {
}
}