码迷,mamicode.com
首页 > Web开发 > 详细

UIWebView

时间:2016-04-06 13:06:23      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:

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

UIWebView

标签:

原文地址:http://www.cnblogs.com/longjie8556264/p/5358653.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!