@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
}
选择图像后,您应该能够使用翻译反转它。我不是 iOS/swift 的专业人士,但在 Android 中,我通过将X
和Y
转换为-1
. 希望这能让你走上正轨
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句