I know that most likely the answer is very obvious, but I've looked everywhere on the internet and I have not found anything. I use this method to see if the user presses on the WebView
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; {
I can assure you that it works.
What I want to do is to make different actions according to the id
es
<a id="hello" href="..."><img src="..." /></a>
once the delegate detect "touch click" on the img with the "hello" id, I would do some custom stuff, like [self callSomething];
Could you show me how to do it using a sample code? thanks
change your code as follows
<a id="hello" href='didTap://image><img src="..." /></a>
and in the delegate method try like this.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString *absoluteUrl = [[request URL] absoluteString];
NSString*temp=[absoluteUrl stringByReplacingOccurrencesOfString:@"@" withString:@""];
if ([temp isEqualToString:@"didTap://image"])
{
[self your method];
}
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With