From dffff12607c08a3500eb891ccf08cad2d9f654f2 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Thu, 16 Sep 2010 13:01:14 +0200 Subject: [PATCH] If nil is given as URL to setImageWithURL:, set the image to the placeholder image (or nil if no placeholder) This is the recommanded way clear an image for reuse (as a UITableViewCell for instance). Calling setImageWithURL: with nil URL will have the effect to cancel an eventual currently in progress download of a thumbnail for this UIImageView. Affecting the image property directly won't have this effect and may lead to image being re-affected once download is completed. --- UIImageView+WebCache.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UIImageView+WebCache.m b/UIImageView+WebCache.m index 24c7c493..4f95d7a8 100644 --- a/UIImageView+WebCache.m +++ b/UIImageView+WebCache.m @@ -28,6 +28,10 @@ { cachedImage = [manager imageWithURL:url]; } + else + { + self.image = placeholder; + } if (cachedImage) {