rs/SDWebImage — pull request #193 by joshavant (2012-10-10 19:37:45+00:00)
Title: 'prepare' block added to UIImageView category

Hi,

I added a `prepare` block to the UIImageView category, which is called when an image is not found in cache and about to be downloaded.

My use case for this was trying to show a modal view. With the current SDWebImage implementation, I'd have to show the modal view outside of the `setImageWithURL...` call, then `dismiss` it in the `success` block.

If the image is already cached, this results in a flicking modal view that is added and quickly removed, since it is just loaded from cache and `success` is quickly called.

I needed a block for the specific state that occurs right before an image download, when an image is not in cache, so I can add the modal view only if the image needs to download. This is what my new `prepare` argument does.

Hope this helps!