- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
//编辑移除
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSString *key = self.keyArray[indexPath.section];
NSMutableArray *arr = self.addressDic[key];
if (arr.count == 1) {
[self.addressDic removeObjectForKey:key];
[self.keyArray removeObjectAtIndex:indexPath.section];
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:indexPath.section];
[tableView deleteSections:indexSet withRowAnimation:UITableViewRowAnimationFade];
} else {
[arr removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
}
编辑移除
最新推荐文章于 2023-04-07 10:59:50 发布