下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
//创建UIWebVIEwWebVIEw = [[UIWebVIEw alloc] initWithFrame:CGRectMake(0,44,320,400)];[WebVIEw setUserInteractionEnabled:NO];[WebVIEw setBackgroundcolor:[UIcolor clearcolor]];[WebVIEw setDelegate:self];[WebVIEw setopaque:NO];//使网页透明Nsstring *path = @"http://www.baIDu.com";NSURL *url = [NSURL URLWithString:path];[WebVIEw loadRequest:[NSURLRequest requestWithURL:url]];//创建UIActivityIndicatorVIEw背底半透明VIEw UIVIEw *vIEw = [[UIVIEw alloc] initWithFrame:CGRectMake(0,480)];[vIEw setTag:103];[vIEw setBackgroundcolor:[UIcolor blackcolor]];[vIEw setAlpha:0.8];[self.vIEw addSubvIEw:vIEw];activityIndicator = [[UIActivityIndicatorVIEw alloc] initWithFrame:CGRectMake(0.0f,0.0f,32.0f,32.0f)];[activityIndicator setCenter:vIEw.center];[activityIndicator setActivityIndicatorVIEwStyle:UIActivityIndicatorVIEwStyleWhite];[vIEw addSubvIEw:activityIndicator];[self.vIEw addSubvIEw:WebVIEw];[vIEw release];[WebVIEw release];//开始加载数据- (voID)webVIEwDIDStartLoad:(UIWebVIEw *)webVIEw { [activityIndicator startAnimating]; }//数据加载完- (voID)webVIEwDIDFinishLoad:(UIWebVIEw *)webVIEw { [activityIndicator stopAnimating]; UIVIEw *vIEw = (UIVIEw *)[self.vIEw vIEwWithTag:103]; [vIEw removeFromSupervIEw];}
第二种方法:使用UIAlertVIEw and UIActivityIndicatorVIEw
/加载网页动画- (voID)webVIEwDIDStartLoad:(UIWebVIEw *)webVIEw{ if (myAlert==nil){ myAlert = [[UIAlertVIEw alloc] initWithTitle:nil message: @"读取中..." delegate: self cancelbuttonTitle: nil otherbuttonTitles: nil]; UIActivityIndicatorVIEw *activityVIEw = [[UIActivityIndicatorVIEw alloc] initWithActivityIndicatorStyle:UIActivityIndicatorVIEwStyleWhite]; activityVIEw.frame = CGRectMake(120.f,48.0f,38.0f,38.0f); [myAlert addSubvIEw:activityVIEw]; [activityVIEw startAnimating]; [myAlert show]; }}- (voID)webVIEwDIDFinishLoad:(UIWebVIEw *)webVIEw{ [myAlert dismissWithClickedbuttonIndex:0 animated:YES];}
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的iOS应用中网络等待Loading的实现方法全部内容,希望文章能够帮你解决iOS应用中网络等待Loading的实现方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)