@IBAction func mirrorBtn(sender: AnyObject){
self.makeMirroredImage(imageView)
pickImage.image = imageView
}
func makeMirroredImage(image: UIImage) -> UIImage {
var flippedOrientation: UIImageOrientation = .UpMirrored
switch image.imageOrientation {
case .Down:
flippedOrientation = .DownMirrored
case .Left:
flippedOrientation = .LeftMirrored
default :
flippedOrientation = .LeftMirrored
}
let flippedImage: UIImage = UIImage(CGImage: image.CGImage!, scale: image.scale, orientation: flippedOrientation)
return flippedImage
}
答案 0 :(得分:1)
选择图像后,您应该能够使用平移将其反转。我不是iOS / swift的专业人士,但在Android中,我通过将X
和Y
翻译设置为-1
来实现这一目标。希望这能让你走上正轨