UIImage *imaged = [UIImage imageWithCGImage:image.CGImage scale:1.0 orientation:UIImageOrientationUp];
/*
cgImage:cgImage = image.CGImage image爲原始圖片
scale:原始圖片放大倍數
orientation:即UIImage的imageOrientation屬性 控制image的繪製方向
*/
+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation API_AVAILABLE(ios(4.0));
/*
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
};
*/
UIImageOrientationUp:表示圖片的正常狀態
UIImageOrientationDown:表示圖片被翻轉180°
UIImageOrientationLeft:表示圖片被逆時針翻轉90°
UIImageOrientationRight:表示圖片被順時針翻轉90°
UIImageOrientationUpMirrored:表示圖片的正常狀態的鏡面圖像
UIImageOrientationDownMirrored:表示圖片被翻轉180°後的鏡面圖像
UIImageOrientationLeftMirrored:表示圖片被逆時針翻轉90°後的鏡面圖像
UIImageOrientationRightMirrored:表示圖片被順時針翻轉90°後的鏡面圖像
相關文章