I\'m using SDWebView image and i want to show an Activity Indicator as placeholder, while fetching the image from remote.
I tried Malek\'s answer here How to show an act
Best solution that worked for me is below. It is beautiful and encouraging to show progress indicator when image is downloading. I used UICircularSlider as rounded progress view. You can also try it.
[_imgPost sd_setImageWithURL:urlPost placeholderImage:zeroImage options:SDWebImageContinueInBackground progress:^(NSInteger receivedSize, NSInteger expectedSize)
{
CGFloat domandeFloat = [[NSNumber numberWithInteger: receivedSize] floatValue];
CGFloat corretteFloat = [[NSNumber numberWithInteger: expectedSize] floatValue];
float currentProgress = (domandeFloat/corretteFloat)*100;
NSLog(@"progress %.f%%",currentProgress);
DBG(@"%li, %li", receivedSize, expectedSize);
[_progress setValue:currentProgress];
} completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
[_progress setHidden:YES];
}];
Here _progress
is an instance of UICircularSlider