UIWebView触摸,手势不起作用

时间:2014-02-05 08:33:52

标签: ios iphone objective-c uiwebview

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

1 个答案:

答案 0 :(得分:0)

嗨,你可以试试这个,

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

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

由于