UIWebView is a great control to display formatted text (using HTML language). That text might contain links that you want to intercept in Objective-C and do a specific action (push a new view for example).
You can do this by implementing UIWebViewDelegate protocol…
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSArray *parts = [[[request URL] absoluteString] componentsSeparatedByString:@"#language_id_"];
if ([parts count] == 2) {
TranslationViewController *vc = [[TranslationViewController alloc] initWithNibName:@"PrayerTranslationView" bundle:nil];
[self presentModalViewController:vc animated:YES];
[vc release];
return FALSE;
}
return TRUE;
}In that method you can check the requested URL and decide if you want to allow the standard flow, navigation to that URL (by returning TRUE), or do something else instead. In the example above we are showing a new view.



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