我想在UITextView中禁用雙擊。我已經禁用長按用:禁用雙擊UITextView
- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
gestureRecognizer.enabled = NO;
}
[super addGestureRecognizer:gestureRecognizer];
return;
}
我已經tryed做UITapGestureRecognizer相同,但它禁止單一的水龍頭了。
- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
gestureRecognizer.enabled = NO;
}
if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
gestureRecognizer.enabled = NO;
}
[super addGestureRecognizer:gestureRecognizer];
return;
}
如何才能禁用雙擊?
我知道numberOfTapsRequired方法,但不知道如何在我的代碼中完全應用它。
我試過了。有沒有在'UIGestureRecognizer *'類型的對象上找到'Property'numberOfTapsRequired' –
好吧,這是因爲向下傾向於'UITapGestureRecognizer'('UITapGestureRecognizer'子類)丟失了......我編輯了我的答案,現在它工作 – HepaKKes
這就是我需要什麼,謝謝 –