iPhone - UIWebview - Get the URL of the link clicked

后端 未结 3 897
借酒劲吻你
借酒劲吻你 2020-11-30 06:01

I\'m creating an app which has a text field & go button on top and web view below them. When user enters URL in text field and clicks \"Go\" button, it will start loadin

3条回答
  •  情话喂你
    2020-11-30 06:34

    Implement this in your UIWebViewDelegate class

    - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
        //CAPTURE USER LINK-CLICK.
          NSURL *url = [request URL];
          yourTextBox.text =   [url absoluteString];
    
    
          return YES;   
    }
    

提交回复
热议问题