2011-12-26 29 views
0

我正在嘗試電子書閱讀應用程序。我希望通過點擊索引頁面鏈接來創建UIActionSheet。爲此,我如何識別webView中的觸摸事件,因爲WebView已經具有內置的longTouch事件。有什麼方法可以在webView中識別longtouch事件嗎?有什麼方法可以在UIWebView中找到手勢識別器

回答

2

只是簡單地覆蓋下面的方法來工作,我們gerstures

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer 
     *)otherGestureRecognizer 
    { 
     return YES; 
    } 

     For adding longPress add to your view 



UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)]; 
longPress.minimumPressDuration=0.8; 
longPress.delegate = self; 
[self addGestureRecognizer:longPress]; 
[longPress release]; 

- (void)longPress:(UILongPressGestureRecognizer*)gesture 
{ 
} 
+0

我嘗試過,但它不進入長按:method..and它顯示了內置的彈出窗口。 – Developer 2011-12-26 10:25:40

+0

我忘記添加代表longPress然後它會打電話給 – Narayana 2011-12-26 10:36:45

+0

謝謝它很好! – Developer 2011-12-26 10:56:28