dispatch_queue_t downloadQueue = dispatch_queue_create("image", NULL);
dispatch_async(downloadQueue, ^{
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://blogs-images.forbes.com/jasonevangelho/files/2013/01/iphone5.jpeg"]];
dispatch_async(dispatch_get_main_queue(), ^{
UIImage *image = [UIImage imageWithData:imageData];
imageView.image = image;
imageView.frame = CGRectMake(0, 0, image.size.width, image.size.height);
scrollView.contentSize = image.size;
});
});
dispatch_release(downloadQueue);
No comments:
Post a Comment