@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
}
Asked
Active
Viewed 203 times
1
-
1Can you provide some code that you have tried? – Asdrubal Jul 24 '16 at 15:35
-
@Asdrubal i have my function for mirroring.It is not working – nandini23 Jul 24 '16 at 15:54
-
You mean something like this? http://stackoverflow.com/questions/10936590/flip-nsimage-on-both-axes – Cai Jul 24 '16 at 15:59
1 Answers
1
After the image is selected you should be able to invert it using a translation. I'm not a professional with iOS/swift, but in Android I accomplished this by setting the X
and Y
translation to -1
. Hope this puts you on the right track

Ethan
- 1,905
- 2
- 21
- 50