mirror of
https://github.com/zhigang1992/RETableViewManager.git
synced 2026-01-12 22:51:51 +08:00
rowIndex of cells updating when other cells are deleted
This commit is contained in:
@@ -305,12 +305,24 @@
|
||||
item.deletionHandlerWithCompletion(item, ^{
|
||||
[section removeItemAtIndex:indexPath.row];
|
||||
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
|
||||
for (int i = indexPath.row; i < section.items.count; i++) {
|
||||
RETableViewItem *afterItem = [[section items] objectAtIndex:i];
|
||||
RETableViewCell *cell = (RETableViewCell *)[tableView cellForRowAtIndexPath:afterItem.indexPath];
|
||||
cell.rowIndex--;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (item.deletionHandler)
|
||||
item.deletionHandler(item);
|
||||
[section removeItemAtIndex:indexPath.row];
|
||||
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
|
||||
for (int i = indexPath.row; i < section.items.count; i++) {
|
||||
RETableViewItem *afterItem = [[section items] objectAtIndex:i];
|
||||
RETableViewCell *cell = (RETableViewCell *)[tableView cellForRowAtIndexPath:afterItem.indexPath];
|
||||
cell.rowIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user