【发布时间】:2013-08-28 13:40:29
【问题描述】:
网页完成加载后,活动指示器并未隐藏。 这是我的
.h 文件
@interface PropertyViewController : UIViewController{
IBOutlet UIWebView *propertyNexusHome;
IBOutlet UIActivityIndicatorView *wheel;
NSTimer *timer;
}
.m 文件
- (void)viewDidLoad
{
[super viewDidLoad];
[property loadRequest:[NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.google.com"]]];
[property addSubview:wheel];
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0)
target:self
selector:@selector(loading)
userInfo:nil
repeats:YES];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)loading {
if (!property.loading)
[wheel stopAnimating];
else
[wheel startAnimating];
}
@end
我不知道为什么它没有消失,它是如何在页面加载后停止旋转的。
提前致谢。
【问题讨论】:
-
你做的不对。加载开始后立即添加
UIActivityIndicator,从UIWebView委托中获取。并在加载完成或失败并出现错误时停止它。
标签: ios uiactivityindicatorview