码迷,mamicode.com
首页 > 移动开发 > 详细

iOS GCD下载图片

时间:2015-06-08 11:42:15      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:ios   gcd   

 cell.myimage.layer.masksToBounds=YES;
    cell.myimage.layer.cornerRadius=cell.myimage.frame.size.width/2;
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSURL *url=[NSURL URLWithString:cellInfo.image];
        NSData *data=[[NSData alloc]initWithContentsOfURL:url];
        UIImage *iamge=[[UIImage alloc]initWithData:data];
        if (data!=nil) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [cell.myimage setBackgroundImage:iamge forState:UIControlStateNormal];
            });
        }
    });

iOS GCD下载图片

标签:ios   gcd   

原文地址:http://blog.csdn.net/darongzi1314/article/details/46409657

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!