我如何计算模拟器中的双击?
答案 0 :(得分:7)
- (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event
{
UITouch *touch = [touches anyObject];
if (touch.tapCount == 2)
{
// do your stuff here
}
}
答案 1 :(得分:1)
实现UIResponder中定义的触摸功能之一(touchesBegan,touchEnded等...)。当你得到touches数组时,你可以使用如下代码获得UITouch的点击次数:
UITouch * t = [touches anyObject];
NSLog(@"%d", [t tapCount]);