背景:定制了UIImagePickController的view,用横版的UI,引导用户去做横屏拍摄,
需求: 让用户在确认照片时,照片始终横版向右
设备的方向:
typedef enum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait,
UIDeviceOrientationPortraitUpsideDown,
UIDeviceOrientationLandscapeLeft,
UIDeviceOrientationLandscapeRight,
UIDeviceOrientationFaceUp,
UIDeviceOrientationFaceDown
} UIDeviceOrientation;
typedef NS_ENUM(NSInteger, UIImageOrientation) {
UIImageOrientationUp, // default orientation
UIImageOrientationDown, // 180 deg rotation
UIImageOrientationLeft, // 90 deg CCW
UIImageOrientationRight, // 90 deg CW
UIImageOrientationUpMirrored, // as above but image mirrored along other axis. horizontal flip
UIImageOrientationDownMirrored, // horizontal flip
UIImageOrientationLeftMirrored, // vertical flip
UIImageOrientationRightMirrored, // vertical flip
};
https://gist.github.com/alex-cellcity/1531596transform = CGAffineTransformTranslate ( transform , self . size . width , 0 );transform = CGAffineTransformRotate ( transform , M_PI_2 );工程源代码
CGImageRef ciimage = self.CGImage;
UIImage *image = [[UIImage alloc] initWithCGImage:ciimage scale:1.0 orientation:UIImageOrientationUp];
UIImage方向问题
http://www.cnblogs.com/smileEvday/archive/2013/05/14/UIImage.html