使用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];
相關文章
相關標籤/搜索