Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 限制拖动到特定部分_Ios_Uitableview - Fatal编程技术网

Ios 限制拖动到特定部分

Ios 限制拖动到特定部分,ios,uitableview,Ios,Uitableview,我想将拖动选项限制在单个表视图中的特定部分上。现在我只在特定部分的单个部分上启用了拖动选项,但当使用“将单元格成功移动到未启用拖动的其他部分”时会发生什么情况,所以它不应该移动到未启用拖动的部分。请参阅附件中的图片,我在第一节中启用了“删除”编辑功能,在第一节中启用了“拖动”功能,并且该行不能移动到第一节。我想在单个单元格中执行此操作。这是否可能?如果可能,那么如何实现? 这对我来说太好了。提前谢谢。 使用。它是一个UITableViewDelegate方法,允许您截取用户试图将单元格拖动到的索

我想将拖动选项限制在单个表视图中的特定部分上。现在我只在特定部分的单个部分上启用了拖动选项,但当使用“将单元格成功移动到未启用拖动的其他部分”时会发生什么情况,所以它不应该移动到未启用拖动的部分。请参阅附件中的图片,我在第一节中启用了“删除”编辑功能,在第一节中启用了“拖动”功能,并且该行不能移动到第一节。我想在单个单元格中执行此操作。这是否可能?如果可能,那么如何实现? 这对我来说太好了。提前谢谢。 使用。它是一个UITableViewDelegate方法,允许您截取用户试图将单元格拖动到的索引路径。如果部分位于您不希望它们能够拖动单元格的某个位置,只需返回源索引路径,释放后,单元格将反弹回其原始位置

- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
{
    if (proposedDestinationIndexPath.section == sectionYouDontWant) {
        return sourceIndexPath;
    }
    return proposedDestinationIndexPath;
}
使用。它是一个UITableViewDelegate方法,允许您截取用户试图将单元格拖动到的索引路径。如果部分位于您不希望它们能够拖动单元格的某个位置,只需返回源索引路径,释放后,单元格将反弹回其原始位置

- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
{
    if (proposedDestinationIndexPath.section == sectionYouDontWant) {
        return sourceIndexPath;
    }
    return proposedDestinationIndexPath;
}