答案 0 :(得分:0)
让代表为您解决这个问题。那就是为什么它在那里! - tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:
答案 1 :(得分:0)
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath: (NSIndexPath *)proposedDestinationIndexPath
{
if (proposedDestinationIndexPath.section != sourceIndexPath.section)
{
return sourceIndexPath;
}
return proposedDestinationIndexPath;
}
不要忘记在tableView中执行另一项检查:moveRowAtIndexPath:toIndexPath:数据源方法,如下所示,当目标与源类似时,您不希望运行应用程序逻辑。
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
if(sourceIndexPath == destinationIndexPath)
{
return;
}
//application logic
}