我想旋转图像并使用以下代码。
switch (_adjustedImage.imageOrientation)
{
case UIImageOrientationRight:
_adjustedImage = [[UIImage alloc] initWithCGImage: _adjustedImage.CGImage
scale: 1.0
orientation: UIImageOrientationDown];
break;
case UIImageOrientationDown:
_adjustedImage = [[UIImage alloc] initWithCGImage: _adjustedImage.CGImage
scale: 1.0
orientation: UIImageOrientationLeft];
break;
case UIImageOrientationLeft:
_adjustedImage = [[UIImage alloc] initWithCGImage: _adjustedImage.CGImage
scale: 1.0
orientation: UIImageOrientationUp];
break;
case UIImageOrientationUp:
_adjustedImage = [[UIImage alloc] initWithCGImage: _adjustedImage.CGImage
scale: 1.0
orientation: UIImageOrientationRight];
break;
default:
break;
}
但是在调试调整后的图像时,_adjustedImage
没有旋转,而是在图像视图上更新,因此在保存图像时图像与以前的方向相同。