2014-02-05 27 views
0

UIWebView的觸摸,手勢不工作,如果我加載網頁鑑於這樣UIWebView的倒是,姿勢不工作

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

請顯示你如何實現你的功能'panDetected:' – KIDdAe

+0

你可以顯示你的panDetected:方法 –

+0

你是否已將'UIGestureRecognizerDelegate'添加到你的控制器?然後recognizer.delegate'設置'到你的'panDetected控制器:'方法實現 – matthisb

回答

0

內容嗨,你可以用這個試試,

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

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

感謝