UITableView-如何停止拖动开始时取消触摸事件?

时间:2018-10-14 10:47:24

标签: ios swift uitableview

我已经在具有dragInteractionEnabled = true的UITableView中实现了touchesbegan,touchesMoved,touchesEnded和touchesCancelled。在触摸表格视图时,将调用touchesBegan,但是一段时间后开始拖动,并且touchesCancelled被自动调用。有没有办法保持触摸直到用户将手指从tableView上抬起?

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    print("touchesBegan")
}

override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
    print("touchesEnded")
}

override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
    print("touchesMoved")
}

override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
    print("touchesCancelled")
}

0 个答案:

没有答案