2011. 10. 31. 16:37
IPhone
Block & GCD를 이용한 async 처리
dispatch_queue_t image_queue = dispatch_queue_create("image_que", NULL);
dispatch_async(image_queue, ^{
NSData *iconData = [NSData dataWithContentsOfURL:[NSURL URLWithString:selectedExample.iconPath]];
_iconImageView.image = [UIImage imageWithData:iconData];
// UI 는 메인 쓰레드에서 변경되어야 하므로...
dispatch_async(dispatch_get_main_queue(), ^{
_iconImageView.image = [UIImage imageWithData:iconData];
});
});