活动指示器在网页加载完成后没有隐藏。
以下是我的.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
我不确定为什么它没有消失,但是当页面加载完毕时,它会停止旋转。
提前感谢您。
UIWebView
代理获取UIActivityIndicator
并添加它。当加载完成或出现错误时停止它。 - Desdenova