UITableView 左滑刪除
// tableView 編輯
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row == self.sightModel.equipmentList.count){
returnNO;
}
else{
returnYES;
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(
{
returnUITableViewCellEditingStyleDelete;
}
- (void)tableView :(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *equipmentList = [[NSMutableArrayalloc]initWithArray:self.
[equipmentList removeObjectAtIndex:indexPath.row];
self.sightModel.equipmentList = equipmentList;
// [self.tableView reloadData];
[self.tableViewdeleteRowsAtIndexPaths:[NSArrayarrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
/** 2. TableView
// [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
}