【发布时间】:2016-07-28 13:48:45
【问题描述】:
如何使用校正方向旋转图像
我在下面放了代码,但没有工作
UIImage *images = [UIImage imageWithCGImage:[rep fullScreenImage] scale:[rep scale] orientation:0];
【问题讨论】:
标签: ios objective-c
如何使用校正方向旋转图像
我在下面放了代码,但没有工作
UIImage *images = [UIImage imageWithCGImage:[rep fullScreenImage] scale:[rep scale] orientation:0];
【问题讨论】:
标签: ios objective-c
UIImageOrientation 指定图像的可能方向:
typedef enum {
UIImageOrientationUp,
UIImageOrientationDown , // 180 deg rotation
UIImageOrientationLeft , // 90 deg CW
UIImageOrientationRight , // 90 deg CCW
UIImageOrientationUpMirrored , // as above but image mirrored along
// other axis. horizontal flip
UIImageOrientationDownMirrored , // horizontal flip
UIImageOrientationLeftMirrored , // vertical flip
UIImageOrientationRightMirrored , // vertical flip
} UIImageOrientation;
在您的代码中,您传递了0,这意味着UIImageOrientationUp 枚举值,对您而言,它当然看起来像默认图像。
因此,您需要将此参数指定为您想要的方向。
例如以下代码将进行垂直图像翻转:
UIImage *images = [UIImage imageWithCGImage:[rep fullScreenImage] scale:[rep scale] orientation: UIImageOrientationLeftMirrored];
【讨论】: