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