UIActivityIndicator-for-SDWebImage icon indicating copy to clipboard operation
UIActivityIndicator-for-SDWebImage copied to clipboard

Complete closure is called 4 times per image

Open confile opened this issue 10 years ago • 5 comments

I use the following code in an `init()`` constructor:

    if let url: NSURL = NSURL(string: previewCard.getImageUrls().getWithInt(0) as! String) {
      self.imageView?.setImageWithURL(url, placeholderImage: MGImage.imageWithColor(UIColor.clearColor()), options: SDWebImageOptions.RefreshCached, completed: { (image:UIImage!, error:NSError!, type:SDImageCacheType, loadUrl:NSURL!) -> Void in

        println("-------------- done")
        }, usingActivityIndicatorStyle: UIActivityIndicatorViewStyle.Gray)

    }

The console output is:

 println("-------------- done")
 println("-------------- done")
 println("-------------- done")
 println("-------------- done")

Why is the complete closure called four times? Is this a bug?

confile avatar Jul 08 '15 11:07 confile

I cannot verify this; but I have also found performance issues with this component in the past.

fatuhoku avatar Jul 19 '15 14:07 fatuhoku

@fatuhoku Do you have any workaround?

confile avatar Jul 19 '15 16:07 confile

No; I solved my performance issue by not simply not using UIActivityIndicator-for-SDWebImage at all! No indicator is better than slow scrolling.

fatuhoku avatar Jul 19 '15 17:07 fatuhoku

Which performance issues are you talking about. How many images did you use when you had issues?

confile avatar Jul 19 '15 17:07 confile

@confile I used NZCircularImageView inside of UICollectionViewCells. It loads this component. It made scrolling really really slow!

fatuhoku avatar Jul 19 '15 18:07 fatuhoku