如果我添加一個手勢識別來如何將手勢識別器添加到UIWebView子類?
UILongPressGestureRecognizer *_longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(webViewGestureRecognized:)];
_longPressRecognizer.allowableMovement = 20;
_longPressRecognizer.minimumPressDuration = 1.0f;
[webView addGestureRecognizer:_longPressRecognizer];
[_longPressRecognizer release], _longPressRecognizer = nil;
當我執行長按-webViewGestureRecognized:
選擇不叫子類的實例UIWebView
稱爲webView
,例如:。
我已覆蓋委託方法-gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
,但長按選擇器仍未調用。
- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
有什麼我可以做,使我自己的手勢識別器在網絡視圖?
你解決了這個問題嗎?我也在研究同一個問題...請幫我解決ip問題.. – Warrior 2010-09-17 11:01:02
它適用於我。你有沒有嘗試*不設置* allowableMovement和minimumPressDuration?爲什麼_longPressRecognizer =零?不清楚。 – Alex1987 2011-01-23 22:44:16
如果你已經解決了這個問題,你能否發表答案?我也在尋找同樣的東西。您的答覆將不勝感激。 – 2013-07-03 06:14:53