Приложение для iPad - трогает Начать двойное нажатие не правильно - PullRequest
0 голосов
/ 13 февраля 2012

У меня есть UIViewController, который имеет функцию touchesBegan и выводит позиции.

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    NSLog(@"in");

    NSArray *touchesArray = [touches allObjects];
    for(int i=0; i<1; i++)
    {
        UITouch *touch = (UITouch *)[touchesArray objectAtIndex:i];
        CGPoint point = [touch locationInView:touch.view];
        NSLog(@"point = %f %f",point.x,point.y);
    }
}

Если я дважды быстро нажму на середину экрана, я получу следующий вывод

2012-02-12 21:47:13.522 MoreMost[479:707] in
2012-02-12 21:47:13.523 MoreMost[479:707] point = 698.000000 86.000000
2012-02-12 21:47:13.617 MoreMost[479:707] in
2012-02-12 21:47:13.619 MoreMost[479:707] point = 39.000000 22.000000

почему этот второй сигнал зарегистрирован как (39,22) ... который похож на верхний левый угол iPad. Тем не менее, я постучал в середине.

Итак, я хотел бы решить это двумя способами:

1) somehow, not let the user double tap (however it seems even when I double tap fast, the touchesBegan function is called on two separate occassions)
2) figure out why that 2nd tap is being registered with the wrong coordinates.

1 Ответ

0 голосов
/ 13 февраля 2012

Это должна быть точка CGPoint = [touch locationInView: self.view]; ... не «touch.view»

...