iOS-image图片旋转方向

图片旋转


UIImage *backImage = [UIImage imageNamed:@"图片名字"];
 
//改变该图片的方向
backImage = [UIImage imageWithCGImage:backImage.CGImage 
                                scale:backImage.scale 
                          orientation:UIImageOrientationDown];

以下是图片方向的选择

UIImageOrientationUp,            // 默认方向
UIImageOrientationDown,          // 让默认方向旋转180度
UIImageOrientationLeft,          // 让默认方向逆时针旋转90度
UIImageOrientationRight,         // 让默认方向顺时针旋转90度
UIImageOrientationUpMirrored,    // 默认方向的竖线镜像
                                 //(即以原图的左(或右)边的竖线为对称轴,对原图进行对称投影得到的镜像)
UIImageOrientationDownMirrored,  // 让镜像旋转180度
UIImageOrientationLeftMirrored,  // 让镜像逆时针旋转90度
UIImageOrientationRightMirrored, // 让镜像顺时针旋转90度

view旋转

水平翻转
view.transform = CGAffineTransformScale(imageView.transform, -1.0, 1.0);

竖直翻转
view.transform = CGAffineTransformScale(imageView.transform, 1.0, -1.0);

你可能感兴趣的:(iOS-image图片旋转方向)