¿cómo puedo cancelar o restablecer un UIGestureRecognizer
? El problema es que si establezco waitForSomething
en NO
durante un gesto, el siguiente evento es UIGestureRecognizerStateChanged
. Pero el primer evento debe ser UIGestureRecognizerStateBegan
.Cómo cancelar/restablecer un UIGestureRecognizer
Mi Código:
- (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;
}
}
Gracias por su ayuda!
funciona como un encanto, gracias – n13
Este es un gran consejo, e incluso recomendado por Apple en un video reciente WWDC –