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