尝试通过UIView筛选双击事件
在iOS应用程序中,我有一个UIWebView,用于显示某些内容,并使用以下机制关闭此UIWebView: 我将UIView的DoubleTapView子类放在UIWebView的顶部 此DoubleTapView捕获双击事件,并执行足够的代码来dimiss自身以及UIWebView。 到目前为止,它运行良好 问题是: UIWebView对滚动内容、点击链接等感兴趣的所有事件。。不要通过;它们被DoubleTapView阻止。我怎样才能解决这个问题 事实上,对于我刚才描述的内容,我可以使用UIView而不是DoubleTapView。 但我打算用DoubleTapView将UIView子类化。然后实施: -voidTouchesBegined:NSSet*接触事件:UIEvent*事件; 或 -voidMotionStart:UIEventSubjectMotion with事件:UIEvent*事件; 为了解决我的问题,我一定是做错了什么,因为它不像我那样在列表中工作 以下是我编写的一些代码,用于将各个部分组合在一起:尝试通过UIView筛选双击事件,uiview,uiviewcontroller,touch-event,touchesbegan,uiresponder,Uiview,Uiviewcontroller,Touch Event,Touchesbegan,Uiresponder,在iOS应用程序中,我有一个UIWebView,用于显示某些内容,并使用以下机制关闭此UIWebView: 我将UIView的DoubleTapView子类放在UIWebView的顶部 此DoubleTapView捕获双击事件,并执行足够的代码来dimiss自身以及UIWebView。 到目前为止,它运行良好 问题是: UIWebView对滚动内容、点击链接等感兴趣的所有事件。。不要通过;它们被DoubleTapView阻止。我怎样才能解决这个问题 事实上,对于我刚才描述的内容,我可以使用UIV
webView=[[UIWebView alloc] initWithFrame:varFrame];
webView.delegate=self;
quitGesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(quitWeb:)];
quitGesture.numberOfTapsRequired=2;
varFrame.origin=CGPointZero;
quitSensor=[[DoubleTapView alloc] initWithFrame:varFrame];
quitSensor.userInteractionEnabled=YES;
[quitSensor addGestureRecognizer:quitGesture];
[webView addSubview:quitSensor];
下面是我在实现DoubleTapView方法时尝试的内容:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[[self superview] touchesBegan:touches withEvent:event];
}
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
[[self superview] motionBegan:motion withEvent:event];
}