Do not call UIGestureRecognizerStateEnded

I am using my UIImageVIew

-(IBAction)handlePanFrom:(UIPanGestureRecognizer *)recognizer 

and in my code I try to use two states:

 if([recognizer state] == UIGestureRecognizerStateBegan) { NSLog(@"Began"); } if([recognizer state] == UIGestureRecognizerStateEnded) { NSLog(@"End"); } 

in the console, I see the message β€œStarted” every time I start moving the UIImageView, but no message β€œEnd” ...

How am I wrong?

+4
source share
1 answer

from apple doc:

 UIGestureRecognizerStateEnded: 

the sign recognizer recognizes as the end of continuous gestures. It sends its message about the action (or messages) to the next cycle of the execution cycle and resets its state to UIGestureRecognizerStatePossible.

plz try UIGestureRecognizerStateCancelled

+2
source

Source: https://habr.com/ru/post/1414182/


All Articles