Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activity indicator in SDWebimage placeholder

How can I set an Activity indicator in SDWebImage placeholder using UIImageView

like image 872
Mhmd Backer Shehadi Avatar asked Mar 04 '14 09:03

Mhmd Backer Shehadi


2 Answers

Swift 5 & SDWebImage 5-beta

//pod file
pod 'SDWebImage', '~> 5.0.0-beta3'

//import 
import SDWebImage

and set indicator and image

myImageView.sd_imageIndicator = SDWebImageActivityIndicator.gray
myImageView.sd_setImage(with: URL(string: "http://url", completed: nil)
like image 172
Lahiru Pinto Avatar answered Oct 11 '22 17:10

Lahiru Pinto


Swift 4

imgView.sd_setShowActivityIndicatorView(true)
imgView.sd_setIndicatorStyle(.gray)
imgView.sd_setImage(with: URL(string: imageURL))

Tested and working

Swift 5

imgView.sd_imageIndicator = SDWebImageActivityIndicator.gray
imgView.sd_setImage(with: URL(string: imageURL))
like image 37
saurabh Avatar answered Oct 11 '22 16:10

saurabh