AVCaptureVideoPreviewLayer不会填满整个iPhone 4S屏幕 [英] AVCaptureVideoPreviewLayer doesn't fill up whole iPhone 4S Screen
本文介绍了AVCaptureVideoPreviewLayer不会填满整个iPhone 4S屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AVCaptureVideoPreviewLayer *avLayer =
[AVCaptureVideoPreviewLayer layerWithSession:session];
avLayer.frame = self.view.frame;
[self.view.layer addSublayer:avLayer];
我使用AVCaptureVideoPreviewLayer在视图上显示视频. 但是视频的视图并没有填满iPhone4的整个屏幕.(右侧和左侧的两个灰色栏)
I use AVCaptureVideoPreviewLayer to display video on the view. But the video's view didn't fill up the full iPhone4's screen.(two grey bar at the right&left side)
我希望视频全屏显示. 我该如何处理?非常感谢你!
I want the video fills up full screen. How can I deal with it? Thank you very much!
推荐答案
也许这可以解决?
CGRect bounds=view.layer.bounds;
avLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
avLayer.bounds=bounds;
avLayer.position=CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
这篇关于AVCaptureVideoPreviewLayer不会填满整个iPhone 4S屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文