gpt4 book ai didi

iPhone UIWebView - 从超链接打开新的 UIWebView Controller

转载 作者:行者123 更新时间:2023-12-03 19:04:39 25 4
gpt4 key购买 nike

我有一个嵌入式网站,有很多链接,但 WebView 窗口相当小,允许放大和缩小列表上方的较大图像。如果可能的话,我需要 webview 响应到带有第二个嵌入式 UIWebView 的新 Controller View 的超链接。

最佳答案

UIWebView 有一个委托(delegate),允许您响应某些事件,例如加载新内容的请求。只需在您的委托(delegate)类中实现以下内容

-(bool) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
//You might need to set up a interceptLinks-Bool since you don't want to intercept the initial loading of the content
if (self.interceptLinks) {
NSURL *url = request.URL;
//This launches your custom ViewController, replace it with your initialization-code
[YourBrowserViewController openBrowserWithUrl:url];
return NO;
}
//No need to intercept the initial request to fill the WebView
else {
self.interceptLinks = YES;
return YES;
}
}

关于iPhone UIWebView - 从超链接打开新的 UIWebView Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3790653/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com