みんな、二UILongPressGestureRecognizer、1が起動することができ、他のことはできません
私は2 UILongPressGestureRecognizerを追加しました。私が欲しいのは、2つのボタンが0.3秒間押し下げられ、 "shortPressHandler"が起動するときです。ユーザーがこれらの2つのボタンをさらに1.2秒間押し続けると、「longPressHandler」が起動します。今私はshortPressHandlerを起動し、longPressHandlerは決して起動しませんでした。私は、shortPressGestureが最初に認識され、longPressGestureが決してチャンスを得ることができない可能性があると思います。誰も私が欲しいものを達成する方法を示すことができますか?前もって感謝します。
UILongPressGestureRecognizer *longPressGesture =[[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)] autorelease];
longPressGesture.numberOfTouchesRequired = 2;
longPressGesture.minimumPressDuration = 1.5;
longPressGesture.allowableMovement = 10;
longPressGesture.cancelsTouchesInView = NO;
longPressGesture.enabled = true;
[self.view addGestureRecognizer:longPressGesture];
UILongPressGestureRecognizer *shortPressGesture =[[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(shortPressHandler:)] autorelease];
shortPressGesture.numberOfTouchesRequired = 2;
shortPressGesture.minimumPressDuration = 0.3;
shortPressGesture.allowableMovement = 10;
shortPressGesture.cancelsTouchesInView = NO;
shortPressGesture.enabled = true;
[self.view addGestureRecognizer:shortPressGesture];
ありがとうございました。ボタンが離されていなくても、私は短くしたいと思ったら、何をすべきか知っていますか? – Globalhawk
申し訳ありませんが、私はこのメッセージが表示されませんでした。あなたの投稿の下に「@name ...」と書かなければなりません。あなたが好きなことを理解していれば、ユーザープレス、shortPressは0.3s彼が彼のプレスを解放しなければ、プレスは1.2秒後に解雇される。あれは正しいですか? –
@rokjarcこれはまさに私が欲しいものです。ありがとう。 – Globalhawk