UIPanGestureRecognizer does not switch to state “End” or “Cancel” if user panned x and y in negative direction

后端 未结 1 651
醉酒成梦
醉酒成梦 2021-02-19 13:04

I\'ve got a little problem with the UIPanGestureRecognizer. The Recognizer does not report the UIGestureRecognizerStateEnded state if the user panned to the top left (means nega

相关标签:
1条回答
  • 2021-02-19 13:38

    The line

    [self addGestureRecognizer:pan];

    looks wrong to me.

    It seems like you are creating the gesture recognizer from inside a UIView and not a UIViewController. So if the view is dealloc both it and the gesture recognizer will disappear.

    Better to create the gesture recognizer from the UIViewController. Also the UIViewController needs to keep a strong point to the recognizer.

    0 讨论(0)
提交回复
热议问题