- /**
- *从图片中按指定的位置大小截取图片的一部分
- * UIImage image 原始的图片
- * CGRect rect 要截取的区域
- */
- - (UIImage *)imageFromImage:(UIImage *)image inRect:(CGRect)rect {
- CGImageRef sourceImageRef = [image CGImage];
- CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect);
- UIImage *newImage = [UIImage imageWithCGImage:newImageRef];
- return newImage;
- }
UIImageView截取图片
最新推荐文章于 2020-08-08 18:05:23 发布