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);
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容