Ethan Allen
Ethan Allen

Reputation: 14835

Is there any way to stop an image in a UIImageView from lazy loading with SDWebImage on iOS?

I'm using the following code to lazy load an image into my UIImageView:

[self.imv1 setImageWithURL:[NSURL URLWithString:myURL]
              placeholderImage:[UIImage imageNamed:@"loading.png"]
                     completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)
     {
         // stuff here
     }];

When a user touches a button, I want the lazy loading of this to STOP completely, so that no image gets loaded and the download of the image stops.

After I stop the lazy loading, I plan to load a different image into the same UIImageView.

Is this possible with SDWebImage?

Upvotes: 1

Views: 704

Answers (1)

Ethan Allen
Ethan Allen

Reputation: 14835

Found out how to do it. I just needed to call this:

[self.imv1 cancelCurrentImageLoad];

Upvotes: 2

Related Questions