I have a UIWebView which is already filled by my request (loadRequest).
I would like to add a UIButton in it. It\'s easy to write this simple code :
You can inject html markup such as into the content of your UIWebview using stringByEvaluatingJavaScriptFromString method.
To capture the click event and prevent it from reloading content of your webview use this delegate:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if(navigationType==UIWebViewNavigationTypeLinkClicked && [[request.URL absoluteString] isEqualToString: @"yourTag01"])
{
//your custom action code goes here
return NO;
}
return YES;
}