美文网首页
网络请求图片,根据范围取图

网络请求图片,根据范围取图

作者: 呦嚯嚯嚯12138 | 来源:发表于2016-11-25 09:50 被阅读16次

CGImageRef temImg = image.CGImage;

float width = CGImageGetWidth(temImg);

float height = CGImageGetHeight(temImg);

temImg = CGImageCreateWithImageInRect(temImg, CGRectMake(width * 0.5 - height * 0.5, 0, height, height));

//得到新的图片

UIImage *new = [UIImage imageWithCGImage:temImg];

shopImage.image = new;

相关文章

网友评论

      本文标题:网络请求图片,根据范围取图

      本文链接:https://www.haomeiwen.com/subject/vyvipttx.html