我正在使用 AvCapture session 进行开发,以在相机屏幕上添加自定义叠加层。我添加了一个 AvCaptureVidePreview 层作为
AvCaptureVideoPreviewLayer*layer = [[AvCaptureVideoPreviewLayer alloc] iniWithSession:session];
layer.frame = self.view.layer.bounds;
但在 iPhone 4S 的情况下,相机预览不是全屏。它在 iPhone 5 中运行良好。
最佳答案
CGRect bounds=view.layer.bounds;
layer.videoGravity = AVLayerVideoGravityResizeAspectFill;
layer.bounds=bounds;
layer.position=CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
也许它能帮到你..
关于ios - iphone 4s 中的 AvCapture Session 全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25565840/