I have a custom resizable view, StickerView
, which has DragView
on each corner to allow resizing. The hierarchy of the view is quite complex, so I override some hitTest
in each view to implement the desired logic, cause im DragViews lay deep in hierarchy. Before implementing the rotation gesture, everything worked fine as expected.
However, the problem arises when I rotate the StickerView
to 45 degrees or close to it(135 and so on). My dragViews do not consistently trigger the UIPanGestureRecognizer
. Sometimes the pan gesture triggers, but not consistently — it might trigger once, then fail to trigger for the next three attempts, and then trigger again.
I’ve checked which view is returned in hitTest
in my mainView, and it’s always the dragView that I am trying to pan. Therefore, the view is correctly identified as the appropriate event handler, but the UIPanGestureRecognizer
does not trigger consistently.
To clarify, I change the transform
property on StickerView
, and all of its subviews (including dragViews) are laid out using constraints within it. I do not change the transform property on any subview directly. Also if view turned on 90/180/270 degree everything works fine.
The issue seems specific to the UIPanGestureRecognizer
on my dragViews. Why does the UIPanGestureRecognizer not trigger consistently, even though hitTest returns the correct dragView?
In my DragView
class, I added print statements in the touch functions (touchesBegan, touchesMoved, touchesEnded), and they trigger every time I try to pan my dragViews. I also tried using a UITapGestureRecognizer on my dragViews for testing purposes, and the tap gesture always triggers.