美文网首页webview
如何用iOS获取网页请求

如何用iOS获取网页请求

作者: hunterzhu | 来源:发表于2016-07-23 21:27 被阅读26次

如今的App中有很多都是网页内嵌在App中的,今天就看看如何将网页内嵌进App.
1.创建一个webView的界面
2.获取连接
3.获取请求
4.调用请求
5.适配屏幕


    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
    
    NSURL *url = [NSURL URLWithString:@"http://www.douyu.com"];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [webView loadRequest:request];
    
    webView.scalesPageToFit = YES;
    
    [self.view addSubview:webView];

非常简单的代码

相关文章

网友评论

    本文标题:如何用iOS获取网页请求

    本文链接:https://www.haomeiwen.com/subject/xxuwjttx.html