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开发者_StackOverflow社区 techniques you prefer or sample projects. The current AVCam project (1.2) removed support for mirroring.
Thanks for all your help guys!
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.
精彩评论