繁体   English   中英

UIWebView触摸,手势不起作用

[英]UIWebView touches, gestures not working

UIWebView触摸,如果我像这样加载Web视图的内容,则手势不起作用

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];

嗨,您可以尝试一下

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

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

谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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