iphone上面的风火轮
来源:互联网 发布:btcc挖矿软件 编辑:程序博客网 时间:2024/05/01 13:27
第一种方法:使用UIView and UIActivityIndicatorView
//创建UIWebView
WebView = [[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, 0, 320, 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, 37.0f, 37.0f);
[myAlert addSubview:activityView]; //把转轮嵌入到对话框中
[activityView startAnimating];
[myAlert show];
}
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
[myAlert dismissWithClickedButtonIndex:0 animated:YES];
}
//创建UIWebView
WebView = [[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, 0, 320, 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, 37.0f, 37.0f);
[myAlert addSubview:activityView]; //把转轮嵌入到对话框中
[activityView startAnimating];
[myAlert show];
}
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
[myAlert dismissWithClickedButtonIndex:0 animated:YES];
}
- iphone上面的风火轮
- 风火轮
- 为什么不要做iPhone上面的应用
- 有意思的一段JS 风火轮
- 们需要在风火轮的下面显示
- iphone上面编写具有root权限的程序
- 如何隐藏掉Iphone上面的状态栏(电池栏)
- 23. iPhone上面的现实增强(Augmented Reality )入门教程
- iphone上面编写具有root权限的程序
- iphone上面编写具有root权限的程序
- iphone上面编写具有root权限的程序
- iphone上面编写具有root权限的程序
- 如何不将iphone上面的数字识别为电话
- 苹果无敌风火轮如果不是那么酷的
- iOS状态栏的网络状态风火轮是否旋转
- iphone上面判断一个对象是否是某个类的对象的方法
- 风火轮雏形
- 在iphone上面执行外部命令的方式(以此可能可以判断iphone是否已经越狱)
- Android编程获取手机的IMEI
- cl 编译选项
- framebuffer
- 关于图片按钮执行js跳转页面时刷新页面的解决方案
- ftrace 简介
- iphone上面的风火轮
- 导出excel小结(C#,.NET,Wpf)
- 门禁的实际应用
- 每天写出好代码的5个建议
- ASP.NET页面刷新的几种实现方法
- (转)Android Market排名算法及规则
- linux-2.6内核模块引用计数的实现
- C#中抽象类与接口的区别
- ASP.NET页面刷新的几种实现方法