我正在尝试使用CGImageCreateWithImageInRect从图片中获取子图像,但无法正常工作。它返回的是图片中随机位置的图像,而不是我指定的图像。请看下面的图片;
我的代码如下:
CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(524, 1331, 600, 600));
UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
但是那样行不通。我做错了什么吗?
谢谢!