execute custom block _before_ setting image

This is particularly useful if you want to animate the image change, e.g. with a core animation block - that's not possible after image is changed.
This commit is contained in:
Peter Steinberger 2011-09-12 17:20:50 +02:00
parent bd6fc88c01
commit 908d77aaaf

View file

@ -109,15 +109,15 @@ static NSString * const kUIImageViewImageRequestObjectKey = @"imageRequestOperat
self.imageRequestOperation = [AFImageRequestOperation operationWithRequest:request imageSize:imageSize options:options success:^(UIImage *image) {
if (self.imageRequestOperation && ![self.imageRequestOperation isCancelled]) {
if (block) {
block(image);
}
if ([[request URL] isEqual:[[self.imageRequestOperation request] URL]]) {
self.image = image;
} else {
self.image = placeholderImage;
}
if (block) {
block(image);
}
}
}
}];