Skip to content

Instantly share code, notes, and snippets.

@rpitting
Created January 29, 2013 09:42
Show Gist options
  • Save rpitting/4663066 to your computer and use it in GitHub Desktop.
Save rpitting/4663066 to your computer and use it in GitHub Desktop.
Loading an image in den background queue, and assigning it to an image view in the main queue. Is this a good pattern?
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
UIImage* image = [UIImage imageWithContentsOfFile:...];
dispatch_async(dispatch_get_main_queue(), ^{
self.targetImageView.image = image;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment