3

次のコードがあります。

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


NSUInteger touchCount = 0;
// Enumerates through all touch objects
for (UITouch *touchb in touches){
    touchCount++;
}


// When multiple touches, report the number of touches. 
if (touchCount > 1) {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking %d touches", touchCount];
} else {
    lblStatustouch.text = [NSString stringWithFormat:@"Tracking 1 touch", touchCount];
}

実行すると、複数のタッチが検出されることはありません。アプリが複数回タッチできないようにする設定はありますか? それとも、ここで何か不足していますか?

4

2 に答える 2

1

また、両方の指が同時に動いている場合にのみ、touchesMovedで複数のタッチが得られることも知っておいてください。画面に1本の指を固定し、2本目の指を動かすと、電話は動いている指のみを報告します。

于 2009-05-10T01:09:19.157 に答える