1) Implement the UIWebViewDelegate
2) Override the
-(BOOL)webView:(UIWebView *)aWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType method..
3) In this method you compare the request with a protocole defined.
Example:
NSString *requestString = [[request URL] absoluteString];
NSArray *components = [requestString componentsSeparatedByString:@":"];
if ([components count] > 1 &&
[(NSString *)[components objectAtIndex:0] isEqualToString:@"myapp"]) {
if([(NSString *)[components objectAtIndex:1] isEqualToString:@"myfunction"])
{
NSLog([components objectAtIndex:2]); // param1
NSLog([components objectAtIndex:3]); // param2
// Call your method in Objective-C method using the above...
}
return NO;
}
4) modify your javascript file to create the protocole:
function showPieChart(parameter1,parameter2)
{
window.location="myapp:" + "myfunction:" + param1 + ":" + param2;
}
resouce :http://www.codingventures.com/2008/12/using-uiwebview-to-render-svg-files/