Currently i am integrating SDWebImage in my project by following below things
1)#import "UIButton+WebCache.h"
2)[button setImageWithURL:url placeholderImage:[UIImage imageNamed:@"no_photo.png"]];
So it will show the list of image present in URL above the respective buttons.
But Now i want to show an activity indicator above button when the image is getting downloaded ,So how can i do this?
Works like a charm for me :
Swift 3:
imgView.setShowActivityIndicator(true)
imgView.setIndicatorStyle(.gray)
imgView.sd_setImage(with: URL(string: urlString), placeholderImage: UIImage(named: "placeholder"))
Swift 4: (Edit : Updates)
imgView.sd_setShowActivityIndicatorView(true)
imgView.sd_setIndicatorStyle(.gray)
imgView.sd_setImage(with: URL(string: urlString), placeholderImage: UIImage(named: "placeholder"))
Swift 5: SDWebImage (5.x.x)
imgView.sd_imageIndicator = SDWebImageActivityIndicator.gray
imgView.sd_setImage(with: URL(string: urlString), placeholderImage: UIImage(named: "placeholder"))
Updates: For UIButton use this
yourButton.sd_setImage(with: URL(string: urlString), for: .normal)