【发布时间】:2012-11-26 21:02:16
【问题描述】:
我正在尝试使用此代码来允许用户在我的应用中缩放和裁剪他们的图像: https://github.com/iosdeveloper/ImageCropper/tree/master/Classes/ImageCropper
代码sn-p
float zoomScale = 1.0 / [scrollView zoomScale];
CGRect rect;
rect.origin.x = [scrollView contentOffset].x * zoomScale;
rect.origin.y = [scrollView contentOffset].y * zoomScale;
rect.size.width = [scrollView bounds].size.width * zoomScale;
rect.size.height = [scrollView bounds].size.height * zoomScale;
CGImageRef cr = CGImageCreateWithImageInRect([[imageView image] CGImage], rect);
UIImage *cropped = [UIImage imageWithCGImage:cr];
CGImageRelease(cr);
[delegate imageCropper:self didFinishCroppingWithImage:cropped];
但它没有考虑旋转的图像(我猜这是 iPhone 图像上的某种元数据)。我不想让用户画一个矩形来裁剪,因为我更喜欢这个界面。
谁能告诉我如何让它不旋转我的图像?
如果有帮助,我正在 iOS 5 和 6 中构建。
[编辑] 此外,这在 Game Center 应用程序中很好地完成,用于上传您的个人资料图片。有人知道我在哪里可以找到它的代码吗?
【问题讨论】: