I have an iPad app with two UIWebviews, one on top of the other. Is there a way to have all the links that are clicked in one, open in only the other view?
A:
Use this in the delegate for your first UIWebView
:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[otherWebView loadRequest:request];
return NO;
}
return YES;
}
Douwe Maan
2010-07-17 22:38:36
Is this a built in method of the UIWebView Class?
Liam
2010-07-17 23:30:09
Oh, where should I place this method? I have an AppDelegate and a ViewController class only.
Liam
2010-07-17 23:31:25
This is a method your `UIWebView` calls on the object you have set as its `delegate`. This method is specified in the `UIWebViewDelegate` protocol this object should use. Which of your two classes this is, depends on what you set as the `UIWebView` 's `delegate`.
Douwe Maan
2010-07-18 09:07:40