UIWebView——>一个简单的网页加载

来源:互联网 发布:逆战刷枪软件安卓版 编辑:程序博客网 时间:2024/05/17 22:49



    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];

 

    NSString *urlStr =@"https://www.baidu.com/";

    //创建request对象
    NSMutableURLRequest *mRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlStr]];
    
    //网页控件加载一个网络请求
    [webView loadRequest:mRequest];
    
    webView.backgroundColor = [UIColor grayColor];
    
    [self.view addSubview:webView];
0 0