在UIwebView shouldStartLoadWithRequest委托调用之后需要点击手势方法

时间:2012-07-17 09:40:10

标签: iphone uiview uiwebview gesture

我的问题是我在UIView内部有一个webView,UIView有轻击手势和Web视图类,具有UIWebView的委托。

我的问题是,当我点击链接时,首先点按,然后点按shouldStartLoadWithRequest。因此,我需要阻止调用为查看而编写的代码。

任何人都有任何想法............

  

修改

网络视图委托代码

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

    if(navigationType == UIWebViewNavigationTypeLinkClicked)
    {
        self.isAnyLinkTapped = YES;
        RELEASE(webURL);
        webURL = [[NSString stringWithFormat:@"%@",[request.URL absoluteString]] retain];
        NSArray *urlCoponents = [[request.URL absoluteString] componentsSeparatedByString:@"/"];
        if([urlCoponents count]>0)
        {
//Some code here

}
}

}

我添加了这样的点击手势

_tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];

并点击下面的代码正在调用。

- (void) tapped:(UITapGestureRecognizer *) recognizer {

    touchPointLocationForTap  = [recognizer locationInView:recognizer.view];

    [(WebViewController*)delegate setIsScreenTouched:YES];

    BOOL isThereAnySelection = [self isThereAnyTextSelectionOnWebView];

    if (!isThereAnySelection)
        [self performSelector:@selector(sendTapEventToWebController) withObject:nil afterDelay:1.2];  

}

1 个答案:

答案 0 :(得分:0)

请发布一些代码,以便每个人都能理解..

顺便说一下 -

您可以识别使用此条件触及的视图

if([[touches view] isKindOfClass:[UIWebView class]]){
//Do whatever you want to do with webview
}else{
//Rest of the code
}