Reputation: 5058
I want to do AsynchronousImage
Loader with ActivityIndicator
for download the Image from URL and set in UITableviewCell
. I used the sdwebimage
but instead of Placeholder image I want to set Activity Indicator
so kinldy help me for this.
Upvotes: 0
Views: 1865
Reputation: 531
You could do it this way :
Add an indicator to your view, place it at the center of your imageview
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[indicator startAnimating];
[indicator setCenter:self.imageView.center];
[self.contentView addSubview:indicator];
Remove the indicator from the superview in the block's succes method.
[_imageView setImageWithURL:[NSURL URLWithString:anURL]
success:^(UIImage *image) {
[indicator removeFromSuperview];
}
failure:^(NSError *error) {
}];
}
Of course you could make a nice subclass for this
Upvotes: 1
Reputation: 653
Activity Indicator is a view and I suppose your placeholder image is only an image.
If sdwebimage doesn't give you the possibility adding view instead of placeholder image, the best way for you will be to use an animated image of an activity indicator.
Upvotes: 0