1

我正在与 AVFoundation 一起使用自定义相机创建 iOS 应用程序。我的问题是相机旋转,改变前后相机的预览层,如何像原生相机应用一样制作动画。翻转动画?

谢谢,

4

1 回答 1

4

尝试这个:

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];
于 2013-11-15T06:42:26.690 回答