我有一个不会重新排序的tableview。看起来从未使用与destinationIndexPath不同的sourceIndexPath调用moveRowAtIndexPath。当我拉一排时,它会弹回到它的起始位置,好像该行不支持移动一样。
我尝试实现所有“canMove / canEdit / proposal”方法以返回YES,但我观察到相同的行为。发生了什么事?
- (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]];
}
答案 0 :(得分:2)
我正在使用IIViewDeckController,它取消了视图中的平移。
设置ViewDeckController时,请执行以下操作: self.panningCancelsTouchesInView = NO;