Drop item (in app)
แล้วก็ทำให้วางได้
override func viewDidLoad() {
super.viewDidLoad()
loadTodo()
tableView?.dragDelegate = self
tableView?.dragInteractionEnabled = true
tableView?.dropDelegate = self
}UITableViewDropDelegatefunc tableView(_ tableView: UITableView, performDropWith coordinator: UITableViewDropCoordinator) {}
func tableView(_ tableView: UITableView, canHandle session: UIDropSession) -> Bool {
return session.localDragSession != nil
}
func tableView(_ tableView: UITableView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UITableViewDropProposal {
return UITableViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
}
Last updated