How to replace isMirrored with isVideoMirrored

I inspired myself with Apple code , but I got a little confused about the AVCaptureVideoPreviewLayer object, which seems to have an obsolete isMirrored method with iOS 6 . Unfortunately, this method is replaced by another, which is in a completely different class! Now it is in the AVCaptureConnection object - isVideoMirrored . I do not use this object in my code, and I have no idea how to use it ...

+4
source share
1 answer

From Apple source code , try changing:

 if ([captureVideoPreviewLayer isMirrored]) { viewCoordinates.x = frameSize.width - viewCoordinates.x; } 

For:

 BOOL videoMirrored; if ([captureVideoPreviewLayer respondsToSelector:@selector(connection)]) { videoMirrored = captureVideoPreviewLayer.connection.isVideoMirrored; } else { videoMirrored = captureVideoPreviewLayer.isMirrored; } if (videoMirrored) { viewCoordinates.x = frameSize.width - viewCoordinates.x; } 

Hope this helps.

Disclaimer: code written in the browser: /

+9
source

All Articles