
If you have a Web View in your view you can call a custom action when the user taps on a link in that UIWebView instance.
Here’s how…
Set the delegate of that UIWebView class instance on your instance of UIViewController class. Now just copy & paste the following code into your class. This code implements the UIWebView instance and adds a call to the custom action (method).
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
if(navigationType == UIWebViewNavigationTypeLinkClicked) {
if (overrideLinksSwitch.on == TRUE) {
[self myMethodAction];
[myWebView stopLoading];
return YES;
}
else {
<>return YES;
}
}
return YES;
}
You can download an example app here.



Where Technology and Religion Collide
iPod Touch 4th Generation, iPad revision and new mysterious iDevice coming in autumn
How to install QuickTime Player 7 on Mac OS X 10.6 Snow Leopard without the DVD
Copy of an NSObject subclass
Android iPad knockoffs… pass
Recent Comments