AVCam不在全屏模式 [英] AVCam not in fullscreen

查看:152
本文介绍了AVCam不在全屏模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将AVCam集成到我的iOS应用中.问题出在iPhone 4中,预览框架不是全屏显示,它的边框是空的...

I've integrated AVCam in my iOS app. The problem is in iPhone 4 the preview frame isn't fullscreen, it has empty side borders...

我该如何解决?

谢谢.

推荐答案

您需要使用AVCaptureVideoPreviewLayervideoGravity属性.

看看

基于问询者建立的解决方案是:

Based on that the solution founded by the asker is:

- (void)setSession:(AVCaptureSession *)session {
    ((AVPlayerLayer *)[self layer]).videoGravity = AVLayerVideoGravityResizeAspectFill;
    ((AVPlayerLayer *)[self layer]).bounds = ((AVPlayerLayer *)[self layer]).bounds;
    [(AVCaptureVideoPreviewLayer *)[self layer] setSession:session];
}

这篇关于AVCam不在全屏模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆