Ios UITableView将单元格拖放到最后一个单元格下方列表的底部
在这个问题上我没有发现任何东西。我希望能够将UITableViewCell拖放到表的底部,即最后一项下面。很明显,我可以把一个单元格拖到最后一个单元格的位置上,但一旦我把它拖到最后一个单元格的区域下面,拖动就会取消,单元格就会回到原来的位置 如何将项目拖动到最后一个项目下方的 我没有在桌子上做任何不寻常的事。这似乎是标准行为Ios UITableView将单元格拖放到最后一个单元格下方列表的底部,ios,swift,uitableview,drag-and-drop,Ios,Swift,Uitableview,Drag And Drop,在这个问题上我没有发现任何东西。我希望能够将UITableViewCell拖放到表的底部,即最后一项下面。很明显,我可以把一个单元格拖到最后一个单元格的位置上,但一旦我把它拖到最后一个单元格的区域下面,拖动就会取消,单元格就会回到原来的位置 如何将项目拖动到最后一个项目下方的 我没有在桌子上做任何不寻常的事。这似乎是标准行为 func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession
func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
if renamingIndexPath != nil { return [] }
return [UIDragItem(itemProvider: NSItemProvider())]
}
func tableView(_ tableView: UITableView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UITableViewDropProposal {
if session.localDragSession != nil { // Drag originated from the same app.
return UITableViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
}
return UITableViewDropProposal(operation: .cancel, intent: .unspecified)
}
func tableView(_ tableView: UITableView, performDropWith coordinator: UITableViewDropCoordinator) {
let destinationIndexPath: IndexPath
if let indexPath = coordinator.destinationIndexPath {
destinationIndexPath = indexPath
} else {
let section = tableView.numberOfSections - 1
let row = tableView.numberOfRows(inSection: section)
destinationIndexPath = IndexPath(row: row, section: section)
}
}
// Keeps the items inside the same app
func tableView(_ tableView: UITableView, dragSessionIsRestrictedToDraggingApplication session: UIDragSession) -> Bool {
return true
}
你能修好吗?你能修好吗?