【发布时间】:2018-03-15 13:30:15
【问题描述】:
我正在快速开发应用程序。我存储了名为 Categories 的异议数据。我在这里添加了tableViewImage,这里没有问题。我想将 tableview 的部分与单元格一起移动,但它没有。我写的函数如下。请帮助我。谢谢。
func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
return true
}
func tableView(_tableview:UITableView, moveRowAtIndexPath sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)
{
let temp = categories[sourceIndexPath.section]
categories[sourceIndexPath.section] = categories[destinationIndexPath.section];
categories[destinationIndexPath.section] = temp
}
func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
return false
}
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
return .none
}
【问题讨论】:
标签: swift uitableview drag-and-drop