如何在UIWebview中識別用戶touch
,tap
& double tap
。是否有像觸摸開始等任何代表開始?UIWebview手勢iOS
0
A
回答
4
這裏是實現單輕叩和雙擊上的WebView
UITapGestureRecognizer *singleTap = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doSingleTap)] autorelease];
singleTap.numberOfTapsRequired = 1;
[self.myWebView addGestureRecognizer:singleTap];
UITapGestureRecognizer *doubleTap = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doDoubleTap)] autorelease];
doubleTap.numberOfTapsRequired = 2;
[self.myWebView addGestureRecognizer:doubleTap];
0
將下面的代碼3個環節就能解決你的問題
how-to-add-a-gesture-recognizer-to-a-uiwebview-subclass
iphone-custom-gestures-on-your-uiwebview
does-uigesturerecognizer-work-on-a-uiwebview
關於抽頭數,你可以將它通過屬性numberOfTapsRequired
如:
UITapGestureRecognizer *myGusture = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doTap)] autorelease];
myGusture.numberOfTapsRequired = 1; //you can change it to any number as per your requirement.
[self.myWebView addGestureRecognizer:myGusture];
[myGusture release];
myGusture = nil;
相關問題
- 1. iPhone - UIWebView手勢
- 2. UIWebView和手勢檢測
- 3. UIWebView覆蓋滑動手勢
- 4. 通過UIWebView捕獲手勢
- 5. 滑動手勢識別UIWebView
- 6. iOS - UITableView Pan手勢
- 7. iOS - UILabels和手勢
- 8. 滑動ios手勢
- 9. iOS - 雙擊手勢不能在UIWebView頂部工作
- 10. 如何在iOS的UIWebView上禁用長按手勢
- 11. IOS 7 Safari歷史記錄拖動使用uiwebview的手勢
- 12. 帶自定義手勢的UIWebView
- 13. 檢測輕掃手勢的UIWebView
- 14. 那裏的長按手勢UIWebView
- 15. 鏈接手勢重新加載UIWebView
- 16. iPhone - 在UIPickerView和UIWebView上的手勢
- 17. Xamarin.Forms - 如何實現手勢識別器在iOS手勢以外的手勢?
- 18. cocos2d-iOS - 手勢識別器
- 19. iOS - 忽略輕擊手勢
- 20. IOS:承認輕掃手勢
- 21. MvvmCross綁定iOS手勢
- 22. 自定義iOS手勢
- 23. 的iOS:自來水手勢
- 24. 關於ios點擊手勢
- 25. iOS上的手勢過濾
- 26. iOS模擬單擊手勢
- 27. iOS按住手勢+點擊
- 28. 捏手勢一個手指ios
- 29. 捏手勢的手勢綁定限制IOS
- 30. iOS捏手勢與滑動手勢衝突
如何才能辨別用戶點擊單個或兩次。有代表嗎? – Codesen 2012-07-30 09:52:55