当我双击网站的一部分时,UIWebView通常专注于所选内容,现在我希望UIWebView忽略双击,但仍然能够与之交互.
我该怎么做?
双击由UITapGestureRecognizer识别.如果你真的想要这个,请浏览视图层次结构.有点棘手,但它应该工作.
代码如下所示:
- (void)goThroughSubViewFrom:(UIView *)view { for (UIView *v in [view subviews]) { if (v != view) { [self goThroughSubViewFrom:v]; } } for (UIGestureRecognizer *reco in [view gestureRecognizers]) { if ([reco isKindOfClass:[UITapGestureRecognizer class]]) { if ([(UITapGestureRecognizer *)reco numberOfTapsRequired] == 2) { [view removeGestureRecognizer:reco]; } } } }
我在这里放了一个演示:NoDoubleTapWebView
希望能帮助到你.