UIWebView

        UIWebView *view = [[UIWebView alloc] initWithFrame:kScreenBounds];

        [view setUserInteractionEnabled:YES];

        [view setScalesPageToFit:YES];

        [self.view addSubview:view];

        

        NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"];

        [view loadRequest:[NSURLRequest requestWithURL:url]];

 

 

//2.加载本地文件资源
   /* NSURL *url = [NSURL fileURLWithPath:filePath];
  NSURLRequest *request = [NSURLRequest requestWithURL:url];
  [webView loadRequest:request];*/
  //3.读入一个HTML,直接写入一个HTML代码
  //NSString *htmlPath = [[[NSBundle mainBundle]bundlePath]stringByAppendingString:@"webapp/loadar.html"];
  //NSString *htmlString = [NSString stringWithContentsOfURL:htmlPath encoding:NSUTF8StringEncoding error:NULL];
  //[webView loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:htmlPath]];
  
  opaqueView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
  activityIndicatorView = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
  [activityIndicatorView setCenter:opaqueView.center];
  [activityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhite];
  [opaqueView setBackgroundColor:[UIColor blackColor]];
  [opaqueView setAlpha:0.6];
  [self.view addSubview:opaqueView];
  [opaqueView addSubview:activityIndicatorView];
原文地址:https://www.cnblogs.com/tom2015010203/p/5358653.html