Last active
January 18, 2016 19:54
-
-
Save nloko/6c62f3fb578c5d380ef4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.text = self.event.text; | |
__weak id wself = self; | |
NSString *imageUrl = self.event.imageUrl; | |
self.image = nil; | |
self.overlay.image = nil; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
UIImage *image = [[wself downloadImage:imageUrl] scaleWithWidth:cellWidth]; | |
UIImage *blurredImage = [image blurRect:overlayRect]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
// skip if the cell’s event has changed | |
if (![imageUrl isEqualToString:wself.event.imageUrl]) { | |
return; | |
} | |
wself.overlay.image = blurredImage; | |
wself.image = image; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment