I am working with AVFoundation for create iOS app with custom camera. My problem is camera rotate, the preview layer with be changed front/back camera, how to produce animation like native camera app. Flip Animation ?
Thanks,
Try this:
CATransition *animation = [CATransition animation];
animation.duration = .5f;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = @"oglFlip";
if (captureDevice.position == AVCaptureDevicePositionFront) {
animation.subtype = kCATransitionFromRight;
}
else if(captureDevice.position == AVCaptureDevicePositionBack){
animation.subtype = kCATransitionFromLeft;
}
[capturePreviewLayer addAnimation:animation forKey:nil];