iOS 切割图片

1 - (UIImage *)CutImageWithImage:(UIImage *)image withRect:(CGRect)rect
2 {
3     //使用CGImageCreateWithImageInRect方法切割图片,第一个参数为CGImage类型,第二个参数为要切割的CGRect
4     CGImageRef cutImage = CGImageCreateWithImageInRect(image.CGImage, rect);
5     //将切割出得图片转换为UIImage
6     UIImage *resultImage = [UIImage imageWithCGImage:cutImage];
7     return resultImage;
8 }

 

转载于:https://www.cnblogs.com/pretty-guy/p/4027156.html

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...