我有一个不会重新排序的表格 View 。看起来从未使用与 destinationIndexPath 不同的 sourceIndexPath 调用 moveRowAtIndexPath。当我拉动一行时,它会弹回其起始位置,就好像该行不支持移动一样。
我尝试实现所有“canMove/canEdit/propose”方法以返回"is",但我观察到相同的行为。怎么回事?
- (void) tableView:(UITableView *)tableView
moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath {
NSLog(@"%d -> %d", [sourceIndexPath row], [destinationIndexPath row]);
if ([sourceIndexPath row] == [destinationIndexPath row]) {
return;
}
MyDomain *domain = [self getObject];
[domain.stuff exchangeObjectAtIndex:(NSUInteger) [sourceIndexPath row] withObjectAtIndex:(NSUInteger) [destinationIndexPath row]];
}
最佳答案
我正在使用 IIViewDeckController,它取消了 View 中的平移。
设置 ViewDeckController 时,请执行以下操作: self.panningCancelsTouchesInView = NO;
关于ios - uitableview 重新排序不起作用,源始终等于目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16628615/