iOS使用webView加载HTML网页链接简单展示


//网页视图

    _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 64, mWidth, mHeight-64)];

    _webView.delegate = self;

    [self.view addSubview:_webView];

    //加载

    //1、生成请求体

    NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.linkStr]];

    //2、webView加载请求体

    [_webView loadRequest:request];

 

 

#pragma mark webViewDel

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;

- (void)webViewDidStartLoad:(UIWebView *)webView;

- (void)webViewDidFinishLoad:(UIWebView *)webView;

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM