jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

When use lazy loading mode,MBProgressHUD activityIndicator not show again after use “self.HUB hide:YES” #318

Closed loumzy closed 8 years ago

loumzy commented 8 years ago

@property (nonatomic, strong) MBProgressHUD *HUD;

When use lazy loading mode,MBProgressHUD activityIndicator not show again when use "self.HUD show:YES" after using “self.HUB hide:YES”

loumzy commented 8 years ago

Now, I use the code blow solving the problem

- (MBProgressHUD *)HUD {

    if (!_HUD) {
        _HUD = [[MBProgressHUD alloc] initWithView:self.view];
        [self.view addSubview:self.HUD];
    }

    for (UIView *view in _HUD.subviews) {

        if ([view isKindOfClass:[UIActivityIndicatorView class]]) {

            if(view.hidden)view.hidden = NO;
            if(!((UIActivityIndicatorView *)view).isAnimating) [(UIActivityIndicatorView *)view startAnimating];
        }
    }

    return _HUD;
}