如何计算模拟器中的点击?

时间:2009-06-25 15:45:23

标签: objective-c iphone xcode ios-simulator

我如何计算模拟器中的双击?

2 个答案:

答案 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]);