Domanda

I use on the my UIImageVIew the

-(IBAction)handlePanFrom:(UIPanGestureRecognizer *)recognizer

and in the my code I try to use a two state:

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

in the console I see a "Began" message every time when I start move the UIImageView, but no any "End" message...

What I do wrong?

È stato utile?

Soluzione

from apple doc:

UIGestureRecognizerStateEnded:

The gesture recognizer has received touches recognized as the end of a continuous gesture. It sends its action message (or messages) at the next cycle of the run loop and resets its state to UIGestureRecognizerStatePossible.

plz try UIGestureRecognizerStateCancelled

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top