我有一个大尺寸的图像(2048 * 2048px),此图像在iPhone屏幕上显示为320 * 320。我想这样做:如何在iPhone中缩放图像?
在我的应用程序,用户可以打开大尺寸图像(例如,2048 * 2048),图像显示为320 * 320的iPhone屏幕上,并有矩形在图像上,用户可以移动iPhone屏幕上图像内任意位置的矩形,例如矩形(100,100,300,200),那么我想要在原始大小的矩形区域内缩放原始大小的图像。
我尝试过很多办法,
UIImageView *originalImageView = [[UIImage View alloc] initWithImage:originalImage]];
CGRect rect = CGRectMake(100, 100, 300, 200);
UIImage *cropImage = [UIImage imageWithCGImage:CGImageCreateWithImageInRect([originalImageView.image CGImage], rect)];
但我得到的cropImage仅仅是300 * 200大小的图像,无法正常规模。