Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios SVModalWebViewController-从UIWebView传递URL_Ios_Objective C_Uiwebview - Fatal编程技术网

Ios SVModalWebViewController-从UIWebView传递URL

Ios SVModalWebViewController-从UIWebView传递URL,ios,objective-c,uiwebview,Ios,Objective C,Uiwebview,我有一个主UIWebView,我正在尝试使用SVWebViewController打开任何URL。我的代码如下所示 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if (navigationType == UIWebViewNavigationTy

我有一个主UIWebView,我正在尝试使用SVWebViewController打开任何URL。我的代码如下所示

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    if (navigationType == UIWebViewNavigationTypeLinkClicked ) {
        SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithAddress:@"http://google.com"];
        [self presentViewController:webViewController animated:YES completion:NULL];
        return NO;
    }

    return YES;
}
SVWebViewController似乎有一个initWithAddress参数。我想知道是否可以在该参数中传递请求的URL


提前谢谢你。

找到了解决办法。看来我可以和你一起工作

initWithURLRequest:(NSURLRequest*)请求

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    if (navigationType == UIWebViewNavigationTypeLinkClicked ) {
        SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithURLRequest:(NSURLRequest *)request];
        [self presentViewController:webViewController animated:YES completion:NULL];
        return NO;
    }

    return YES;
}