Develop
2014.11.21 14:41

[ios] 비동기 블럭 코드 예제

Views 825 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
- (void)loadThumbnailImage:(void (^)())completionBlock {
    dispatch_queue_t fetchQ = dispatch_queue_create("ConfigureCell", NULL);
    dispatch_async(fetchQ, ^{
        NSURL *address = [NSURL URLWithString:self.smallPictureURl];
        UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:address]];
        dispatch_async(dispatch_get_main_queue(), ^{
            self.thumbnailImage = image;
            completionBlock();
        });
    });
}
?

No Articles

Board Pagination Prev 1 ... 70 71 72 73 74 Next
/ 74