使用WKWebView替换UIWebView

WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 64)];
    
    _urlString = [_urlString stringByReplacingOccurrencesOfString:@" " withString:@""];
    
    if ([_urlString containsString:@"http"]) {
        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
    }else{
        _urlString =[NSString stringWithFormat:@"http://%@",_urlString];
         [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
    }
    

    [self.view addSubview:webView];
相关文章
相关标签/搜索