JJSaccolo / UIActivityIndicator-for-SDWebImage

The easiest way to add a UIActivityView to your SDWebImage view
MIT License
817 stars 161 forks source link

removeActivityIndicator #8

Closed mythodeia closed 10 years ago

mythodeia commented 10 years ago

Hello and thanks for the excellent category. What i am facing is that the activity only shows for the images i see on screen when i first load the view. Then as i scroll down the activity indicator is not showing any more. i checked the code and when the image completes you have: [weakSelf removeActivityIndicator]; which removes the activity from the superview. However this does not make it nil so next time it calls this [self createActivityIndicatorWithStyle:activityStyle]; the code does not go inside the if ([self activityIndicator] == nil) { .... but directly goes to this: [self.activityIndicator startAnimating]; which will not work since the indicator is already removed from the superview.

if i add this: self.activityIndicator = nil; underneath the [[self activityIndicator] removeFromSuperview]; in the removeActivityIndicator method then i can see the loader for all images.

am i missing something else? Does it make sense?

thanks Konstantinos

JJSaccolo commented 10 years ago

Hello and thank you! Good catch, thanks! Yeah, that would works fine... but I'd prefer to don't re-allocate the object if it's possible. I'd prefer to check if it's in the subviews and, if it's not, add it again. I'll do it as soon as possible! Thanks :)

mythodeia commented 10 years ago

yeap...that sounds great thanks