Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.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
Uitableview 在tableView单元格中拖放_Uitableview_Swift4.2 - Fatal编程技术网

Uitableview 在tableView单元格中拖放

Uitableview 在tableView单元格中拖放,uitableview,swift4.2,Uitableview,Swift4.2,我已经在tableView中实现了拖放功能。问题是,当我拖放单元格时,放置位置的索引与拾取位置索引的索引保持相同。我如何保持下跌头寸指数不变 例如:我有两个单元格cell-0和cell-1,它们都有UILable。将单元格-1拖动到第0个索引后,“我的表格”显示: 细胞-1 细胞-0 如果我修改了cell-0标签中的任何更改,它会更改cell-1的标签 拖放后保持单元格索引不变的任何解决方案。或任何其他解决方案将不胜感激 func tableView(_ tableView: UITableVi

我已经在tableView中实现了拖放功能。问题是,当我拖放单元格时,放置位置的索引与拾取位置索引的索引保持相同。我如何保持下跌头寸指数不变

例如:我有两个单元格cell-0和cell-1,它们都有
UILable
。将单元格-1拖动到第0个索引后,“我的表格”显示: 细胞-1 细胞-0

如果我修改了cell-0标签中的任何更改,它会更改cell-1的标签

拖放后保持单元格索引不变的任何解决方案。或任何其他解决方案将不胜感激

func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {

    let movedObject = self.tableStoryArray[sourceIndexPath.row]
    tableStoryArray.remove(at: sourceIndexPath.row)
    tableStoryArray.insert(movedObject, at: destinationIndexPath.row)
    debugPrint("\(sourceIndexPath.row) => \(destinationIndexPath.row)")

}

因此,您的数据没有按照UITableView数据源数组中的索引进行更改?是的,如果我将第一个单元格拖到第三个位置,并在第三个单元格中进行任何更改,则它将在第一个单元格上进行反射。