标签:
[_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;
}];
标签:
原文地址:http://www.cnblogs.com/520lqlst/p/5788858.html