Created
January 3, 2015 23:21
-
-
Save blitzvb/87c8238f23c6de07e4d5 to your computer and use it in GitHub Desktop.
load image in background thread
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
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^(void) { | |
NSData *data0 = [NSData dataWithContentsOfURL:someURL]; | |
UIImage *image = [UIImage imageWithData:data0]; | |
dispatch_sync(dispatch_get_main_queue(), ^(void) { | |
UIImageView* imageView = (UIImageView*)[cell viewWithTag:100]; | |
imageView.image = image; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment