Tap events not dispatched in new view added with addSubview
I have an area of my screen where I want to recognize a long print. I am using UILongPressGestureRecognizer.
As soon as the long press event occurs, I show a custom UIView that has a method touchesMoved
, adding it as a subview. This custom UIView is added right in the center where the long print event happened, it's right under my finger.
Problem: If I keep holding my finger after long press, touchesMoved
in the custom UIView is not called. Only when I lift my finger and touch again is the method recognized touchesMoved
.
Any possible solutions? I believe the problem is that when the touch started, it originated from the main view. Even though I add a new UIView on top of the hierarchy and move my finger over it, it is not recognized i.e. touchesMoved
not called because the view entered the hierarchy after the strokes started.
I've tried a couple of things to reverse the long gesture recognizer but nothing seems to work. Thank.
source to share
No one has answered this question yet
Check out similar questions: