4

网页完成加载后,活动指示器不会隐藏。这是我的

.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

我不知道为什么它没有消失,它是如何在页面加载后停止旋转的。

提前致谢。

4

2 回答 2

10

另一个选项是[wheel setHidesWhenStopped:YES]在您创建活动指示器时进行设置。

于 2013-08-28T13:44:36.777 回答
0

您必须添加:

wheel.hidden = YES;

当它停止动画时

于 2013-08-28T13:41:25.263 回答