您好,我已经搜索了所有内容,但我没有弄清楚!
我有一个带有 5 个导航控件的选项卡栏控制器,在其中一个导航控件中,我有一个视图,里面有一个表格视图,当我单击该项目时,我推送一个新视图,该视图有
view
-webview
-view
我创建了第二个视图(是透明的),因为我需要单击一下来隐藏我的工具栏和导航栏,并且 webview 正在吃掉所有的触摸!我把那个视图和实现在视图控制器上
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch* touch = [touches anyObject];
if(touch.tapCount == 2){
[NSObject cancelPreviousPerformRequestsWithTarget:self];
}
[[wv.subviews objectAtIndex:0] touchesBegan:touches withEvent:event];
[super touchesBegan:touches withEvent:event];
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[[wv.subviews objectAtIndex:0] touchesMoved:touches withEvent:event];
[super touchesMoved:touches withEvent:event];
}
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch* touch = [touches anyObject];
if(touch.tapCount == 1){
[self performSelector:@selector(hideBars) withObject:nil afterDelay:0.3];
}
[[wv.subviews objectAtIndex:0] touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
[[wv.subviews objectAtIndex:0] touchesCancelled:touches withEvent:event];
[super touchesCancelled:touches withEvent:event];
}
wv 是我的 UIWebView IBOutlet 现在我可以在我的控制器中获取触摸并将它们发送到我的 webview。所以我认为一切正常,我可以滚动,但现在当我有链接时,我无法点击它们。并且 webview 正在检测我进行该测试的链接。所以任何其他方式来实现这一点以获得链接中的触摸,或者我应该改变这个解决方法来隐藏工具栏,这样我就可以拥有 webview 的全部功能?感谢您提前提供帮助。