I am working with UIWebView, in the detailed view of my app, I open a url into a webview and embed the webview into my detailed view(which is a uiview). Now the content of the embedded webview has web links, which when clicked open up into the same embedded webview, as should be expected.
The concern for me here is that I want to open the second level links(links clicked from within the embedded webview) into another customized webview component, not into the same embedded webview.
I tried implementing the following method of the UIWebViewDelegate, but I could not achieve the desired result.
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
Implementation:
{
CustomWebView* iWebView = [[CustomWebView alloc] initWithFrame:CGRectMake(0, 0, webView.frame.size.width, webView.frame.size.height)]; //creating custom webview in same frame
[iWebView loadRequest:request];//loading the request into custom webview
[webView addSubview:iWebView]; // adding custom webview overlapping the webview
return NO; //[stop loading the url into the embedded webview]
}