简体   繁体   中英

UIWebView touches, gestures not working

UIWebView touches, gestures are not working if I Loaded the content of web view like this

NSString* htmlPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"source.bundle/index.html"];

NSURL* url = [NSURL fileURLWithPath:htmlPath];
NSLog(@"the urll==%@",url);

NSURLRequest* request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];

UIPanGestureRecognizer *recognizer =[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];

[self.webView addGestureRecognizer:recognizer];

Hi you can try with this,

UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc]
    initWithTarget:self action:@selector(panSubview:)];
[subview addGestureRecognizer:panRecognizer];

// play nice with subview's pan gesture
[YourView.panGestureRecognizer 
    requireGestureRecognizerToFail:panRecognizer];

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM