-(bool) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *url = request.URL;
BrowserLinker *linker= [[BrowserLinker alloc]initWithNibName:@"BLinker" bundle:nil];
[self.navigationController pushViewController:linker animated:YES];
return NO;
}
else {
return YES;
}
}
我在 BrowserLinker 类中声明了一个 UIWebView,并且还声明了该方法。当在 UIWebView 中单击链接时,它必须在新的 ViewController 中打开。有人可以告诉我代码有什么问题吗?顺便说一句,代码改编自 SO answer。
错误:WebKit 在 webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:delegate:Could not load NIB in bundle: 'NSBundle (loaded)' with name 'BLinker'