Cordova: Disabling the click delay (300ms click delay) in UIWebView

三世轮回 提交于 2019-12-17 19:56:18

问题


I've been searching solution for this problem all over Internet. But only answer I get is to use Fastclick. Though Fastclick worked for basic uses, it's add JavaScript execution overhead for touch events, which leads to jank. I have found interesting post about "hacked" UIWebView. The author suggests to add some "hack" code:

for (UIView* view in webView.scrollView.subviews) {
    if ([view.class.description equalsString:@"UIWebBrowserView"]) {
        for (UIGestureRecognizer *gestureRecognizer in view.gestureRecognizers) {
            if ([gestureRecognizer isKindOfClass:UITapGestureRecognizer.class]) {
                UITapGestureRecognizer *tapRecognizer = (UITapGestureRecognizer *) gestureRecognizer;
                if (tapRecognizer.numberOfTapsRequired == 2 && tapRecognizer.numberOfTouchesRequired == 1) {
                    tapRecognizer.enabled = NO;
                    break;
                }
            }
        }
        break;
    }
}

But unfortunately I have no experience with Objective-C. Does anyone know how to add this "hack" to new Cordova iOS project?

来源:https://stackoverflow.com/questions/55155560/cordova-disabling-the-click-delay-300ms-click-delay-in-uiwebview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!