我有一个从 sql db 读取数据的 UITableView。
当我重新排序数据时,它只会更改顶部和底部的数据
从上到下拖动 1
当我让它在 5 时它只切换顶部和底部的。
我正在使用以下
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
[myStringsArray exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row];
}
如何重新排序列表?所以它将是 2,3,4,5,1 而不是 5,2,3,4,1