Cordova: Disabling the click delay (300ms click de

2020-02-06 05:26发布

问题:

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?