Reputation: 4634
I'm looking for some good sample code to toggle mirroring in AVCaptureVideoPreviewLayer. The original AVCam project from WWDC '10 had support but I'm wondering if any of you have other implementation techniques you prefer or sample projects. The current AVCam project (1.2) removed support for mirroring.
Thanks for all your help guys!
Upvotes: 1
Views: 1310
Reputation: 3603
Don't forget AVCapturePreviewLayer is in essentially a Core Animation Layer. I don't know exactly what you're trying to accoplish, but to toggle a CALayer mirroring you could use a UISwitch and define it's IBAction to flip the preview layer like so:
yourPreviewLayer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);
This will flip your layer horizontally 180º, giving a mirror effect, and the off position for the switch, it will rotate it another 180º, cancelling the effect. Good luck.
Upvotes: 4