Pregunta

Quiero hacer algo similar al visor de fotos del iPhone. Cuando solo toque, las barras de interfaz de usuario desaparecen después de un breve retraso. Al pulsar dos veces, se ampliará la imagen. Pero no quiero que le pase nada en doble toque, porque aún no he implementado zoom.

Alguien sabe cómo hacer esto?

[Este post] realmente no ayuda. A menos que usted me dice que es necesario UIGestureRecognizer subclase. Entonces, creo que podría averiguarlo. Alguien tiene algún ejemplo?

¿Fue útil?

Solución

Mire la documentación UITapGestureRecognizer. Hay dos propiedades que desea buscar en:

  • numberOfTapsRequired; y
  • numberOfTouchesRequired

Otros consejos

Salida de PhotoView Three20. Se hace lo que está buscando hacer.

Aquí hay un código que debe ayudar a:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[scrollView addGestureRecognizer:singleTap];
[singleTap release];

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired: 2];
[scrollView addGestureRecognizer:doubleTap];
// this next line will hold callbacks to singleTap until enough time has gone by that doubleTap is not a possibility.  If a doubleTap happens, singleTap will not get called. Otherwise, singleTap's callback gets called.
[singleTap requireGestureRecognizerToFail:doubleTap];
[doubleTap release];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top