1
TableView由3个部分组成,每个部分都附加到一个数组中,这些数组通过每个单元的附属视图中的按钮相互关联,因此当按下按钮时,基础数据源被更改并且表被重新加载以匹配行的更新前后下面的代码编号用于:UITableView更新数据源并使用insertRowsAtIndexPaths后重新加载tableview时重复行?
int sentCount = [[self sendersList] count];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
NSIndexPath *indexPathToMove = [NSIndexPath indexPathForRow:(sentCount - 1) inSection:2];
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPathToMove] withRowAnimation:UITableViewRowAnimationRight];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
[tableview endUpdates];
[tableview reloadData];
我所得到的是原始行的在这个新的indexpath不是细胞本来应该从获得数据后通过的cellForRowAtIndexPath显示重复数据源。
我已经记录并检查行正在插入的部分被调用适当的次数,但显示的值是原始单元格的重复副本。