图像在图像视图中旋转但实际上没有在调试图像上进行raotaing

时间:2015-12-24 07:17:45

标签: ios objective-c uiimageview uiimage

我想旋转图像并使用以下代码。

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没有旋转,而是在图像视图上更新,因此在保存图像时图像与以前的方向相同。

0 个答案:

没有答案