Come posso cancellare o resettare un UIGestureRecognizer
? Il problema è che se imposto waitForSomething
su NO
durante un gesto, l'evento successivo è UIGestureRecognizerStateChanged
. Ma il primo evento dovrebbe essere UIGestureRecognizerStateBegan
.Come annullare/ripristinare un UIGestureRecognizer
My Code:
- (void) panned:(UIPanGestureRecognizer *) recognizer {
if (waitForSomething) {
// cancel or reset the recognizer!
// because the next event should be UIGestureRecognizerStateBegan and not UIGestureRecognizerStateChanged
return;
}
switch (recognizer.state) {
case UIGestureRecognizerStateBegan:
// important initialisation code
break;
case UIGestureRecognizerStateChanged:
// do something
break;
}
}
Grazie per voi aiuto!
funziona come un fascino, grazie – n13
Questa è una grande punta, e anche consigliato da Apple in un recente video WWDC –