图片旋转
let resultImage = UIImage.init(cgImage: image.cgImage!, scale: image.scale, orientation: .upMirrored)
public enum Orientation : Int {
case up = 0 //默认方向
case down = 1 //让默认方向旋转180度
case left = 2 //让默认方向逆时针旋转90度
case right = 3 //让默认方向顺时针旋转90度
case upMirrored = 4 //默认方向的竖线镜像
case downMirrored = 5 //让镜像旋转180度
case leftMirrored = 6 //让镜像逆时针旋转90度
case rightMirrored = 7 //让镜像顺时针旋转90度
}
view旋转
//水平翻转
view.transform = imageView.transform.scaledBy(x: -1.0, y: 1.0);
//竖直翻转
view.transform = imageView.transform.scaledBy(x: 1.0, y: -1.0);
网友评论