Multi-touch no está trabajando en la aplicación para el iPhone que estoy construyendo

StackOverflow https://stackoverflow.com/questions/596638

  •  09-09-2019
  •  | 
  •  

Pregunta

Tengo el siguiente código:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {


NSUInteger touchCount = 0;
// Enumerates through all touch objects
for (UITouch *touchb in touches){
    touchCount++;
}


// When multiple touches, report the number of touches. 
if (touchCount > 1) {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking %d touches", touchCount];
} else {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking 1 touch", touchCount];
}

Cuando lo ejecuto, nunca se detecta más de un toque. ¿Hay un cierto ajuste que puede impedir que mi aplicación de tomar múltiples toques? O me estoy perdiendo algo aquí?

¿Fue útil?

Solución

Necesita habilitar "tacto múltiple" en su Vista en InterfaceBuilder

alt text http://img.skitch.com/20090227-rpkafsxtg56pujk1h1583if88i.jpg

o si se ha creado la vista de código que está establecido con

[theView setMultipleTouchEnabled:YES];

Otros consejos

También saber que sólo se obtendrá múltiples toques en touchesMoved si ambos dedos se mueven al mismo tiempo . Si usted tiene un solo dedo fija en la pantalla, y se mueven alrededor de un segundo dedo, el teléfono sólo reportará el dedo que se mueve.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top