【问题标题】:how to count tap in simulator?如何在模拟器中计算水龙头?
【发布时间】:2010-11-05 21:24:31
【问题描述】:

如何在模拟器中计算双击次数?

【问题讨论】:

    标签: objective-c iphone xcode ios-simulator


    【解决方案1】:
    - (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event
    {
        UITouch *touch = [touches anyObject];
        if (touch.tapCount == 2)
        {
            // do your stuff here
        }
    }
    

    【讨论】:

      【解决方案2】:

      实现 UIResponder 中定义的触摸函数之一(touchesBegan、touchedEnded 等...)。当您获得 touches 数组时,您可以使用如下代码获得 UITouch 的点击次数:

      UITouch * t = [touches anyObject];
      NSLog(@"%d", [t tapCount]);
      

      【讨论】:

      • 嘿!对不起,如果这是愚蠢的 - 但你很快在屏幕上的同一个地方点击了两次,对吧?它应该在模拟器和设备上都可以工作。
      猜你喜欢
      • 1970-01-01
      • 2011-07-06
      • 1970-01-01
      • 2019-06-30
      • 2021-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多