通过 UIWebView 捕获手势
我正在尝试设置一个简单的 iPad 应用程序,它有一个表视图,当您为该表选择一行时,它会显示一个(向下钻取)UIWebView,显示所选网页(与所选行相关)。
一旦进入深入视图,我想捕获每一个触摸和手势(点击、滑动、捏合等),并用它们做我自己的事情。是的,我知道这将使导航和与显示的网页交互变得不可能,这就是想法。
我发现并解决了此网页回答的 Stack Overflow 问题: http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/ 和我无法使用手势来处理想法。
任何建议将不胜感激。谢谢!
I am trying to set up a simple iPad application that has a table view and when you select a row for that table it displays a (drilled down to) UIWebView displaying the selected web page (related to the row selected).
Once in the drilled-down-to view I want to capture EVERY touch and gesture (tap, swipe, pinch, etc) and do my own thing with them. Yes, I know this will make navigating and interacting with the web page displayed impossible, that's the idea.
I have found and played around with the Stack Overflow question that was answered by this wepage: http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/ and I can't get gestures to work with idea.
Any suggestions would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIWebView 已经附加了很多gestureRecognizer。在添加您的手势识别器作为测试单元之前,删除所有这些手势识别器可能是个好主意。
如果你的手势识别器有效,这意味着你基本上可以将默认识别器存储在私有数组中,并且一旦你想再次为你的 webview 提供正常行为,你就可以“重置” UIWebView 识别器
UIWebView already has a lot of gestureRecognizer attached to them. It might be a good idea to remove all those gesture recognizer before adding yours, as a testing unit.
If your gesture recognizer works, that means you could basically store the default recognizer in a private array and as soon as you want to give normal behavior to your webview again, you "reset" the UIWebView recognizer