所以我想让我的 UIWebview 响应触摸事件。我已经阅读了几个关于此的主题。我创建了一个 UIWebView 的子类,将它添加到我的 UIViewController 中并通过 IB 链接它。在我的子类中,我覆盖了 touches end 并调用了 [super touchEnded]。没有帮助。我覆盖了 hittest,但它也不叫 super!
如果我将此代码添加到我的子类 UIWebView:
@implementation UIWebView (CustomView)
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSLog(@"命中");
回归自我;}
@end
然后触摸被转发到超类,但 hittest 不是(!),另外 webview 停止滚动。
好吧,我想在我的 webview 中识别一个触摸并将其传递给 super - 我做错了什么?
编辑:
我想知道,为什么这么多建议包括使用“hittest” - 这导致无法滚动你的 webview ......有什么想法吗?