Reputation: 982
I have one UIWebView
in my iphone app and I have to detect on click method whenever user will click on any hyperlink.
I want to call one method when user will click on hyper link I know about the method
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
but it will be detected whenever any link will be loaded whether user has clicked or not on hyperlink but I want to call method only when user will click on any method. Please get me out of this issue. -Thanks in advance.
Upvotes: 0
Views: 1514
Reputation: 2301
You can check the UIWebViewNavigationType
.
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSLog("User tapped a link.");
}
}
See UIWebView Class Reference for more information.
Upvotes: 2