2010-01-18 65 views

回答

3

是的。查看UIView命名为touches*的方法,具体为:

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

它被检测到移动(?“幻灯片”)时调用,并且不会被多个快速触摸被“愚弄”遭殃。你可以在视图中的当前手指位置和活动内容时发生的时间坐标:

UITouch *touch = [touches anyObject]; 
CGPoint inFrameCoordinate = [touch locationInView:self]; 
NSTimeInterval timestamp = [touch timestamp] 

得到两个坐标之间的距离和时间来计算的速度。

0

那么,UITouch有位置和时间戳的属性;使用这些属性,可以计算两次触摸事件之间的触摸“速度”。

这只适用于单次触摸,当然,您可能需要平滑结果。此外,用户可能能够通过用两个手指交替快速点击来“愚弄”你;-)

相关问题