开发者

AVCaptureVideoPreviewLayer mirroring iPhone 4 and iPad 2

开发者 https://www.devze.com 2023-02-23 02:19 出处:网络
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 implementati

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消