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;

上一篇:Swift实战-豆瓣电台(二)界面布局


下一篇:Swift实战-豆瓣电台(一)准备