0
我有一个表格视图,用户可以按照他希望的顺序移动和重新排列单元格。但是当他多次移动/重新排列单元格时,包含这些项目的数组会被完全搞乱,因为这些项目的顺序很关键,但是视觉上一切都很好。我究竟做错了什么?预先感谢您...在TableView中移动单元格
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
id object1 = [_items5 objectAtIndex:sourceIndexPath.row];
id object2 = [_items5 objectAtIndex:destinationIndexPath.row];
[_items5 replaceObjectAtIndex:sourceIndexPath.row withObject:object2];
[_items5 replaceObjectAtIndex:destinationIndexPath.row withObject:object1];
其中_items5是一个NSMutableArray和viewDidLoad中
初始化
哦..我现在明白了..谢谢! – user1780591