Listening to UITouch event along with UIGestureRecognizer

前端 未结 2 1862
慢半拍i
慢半拍i 2021-01-02 19:07

I am creating a custom UIView and adding a UITapGestureRecognizer on it. I have a handler for the tap gesture. But at the same time I want my UIView to listen to touchesBega

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 19:21

    You need to set cancelsTouchesInView (and likely delaysTouchesBegan and delaysTouchesEnded) to NO for the gesture recognizer. The default behavior of a gesture recognizer is to avoid having both it and the view process the touch. These settings let you fine-tune that behavior.

提交回复
热议问题