加载数据 设置图片圆角方法

 [_iconView sd_setImageWithURL:[NSURL URLWithString:item.image_list] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"] options:SDWebImageCacheMemoryOnly completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {

            // 1.开启图形上下文

            // 比例因素:当前点与像素比例

            UIGraphicsBeginImageContextWithOptions(image.size, NO, 0);

            // 2.描述裁剪区域

            UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, image.size.width, image.size.height)];

            // 3.设置裁剪区域;

            [path addClip];

            // 4.画图片

            [image drawAtPoint:CGPointZero];

            // 5.取出图片

            image = UIGraphicsGetImageFromCurrentImageContext();

            // 6.关闭上下文

            UIGraphicsEndImageContext();

 

            _iconView.image = image;

    }];

 

posted @ 2016-08-19 20:03  阿法狗的世界  阅读(221)  评论(0)    收藏  举报