0
當我點擊我的表格視圖時,它將觸發touchesBegan
和touchesShouldBegin
。但是,我的視圖單元上也有一個UIPanGestureRecognizer
,並且在平移單元時,點擊其他單元不會觸發touchesShouldBegin
。UITableView tapgesture行爲
我需要的原因touchesShouldBegin
是因爲我想在單元格被平移時停止觸摸。有其他方法可以用來做到這一點嗎?我曾嘗試將allowsMultipleSelection
設置爲false
和true
。
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
print("This will always be printed")
}
override func touchesShouldBegin(_ touches: Set<UITouch>, with event: UIEvent?, in view: UIView) -> Bool {
print("This will only be printed when no cells are being panned")
return true
}