1

シミュレータでダブルタップをカウントするにはどうすればよいですか?

4

2 に答える 2

7
- (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event
{
    UITouch *touch = [touches anyObject];
    if (touch.tapCount == 2)
    {
        // do your stuff here
    }
}
于 2009-06-25T16:03:27.670 に答える
1

UIResponderで定義されているタッチ関数の1つ(touchesBegan、touchedEndedなど)を実装します。touches配列を取得すると、次のようなコードを使用してUITouchのタップ数を取得できます。

UITouch * t = [touches anyObject];
NSLog(@"%d", [t tapCount]);
于 2009-06-25T15:53:50.693 に答える