iOS使用webView載入HTML網頁連結簡單展示

weixin_34162629發表於2017-01-18

//網頁檢視

    _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;

相關文章