2014-08-29 56 views
2

我正在開發AvCapture會議,在相機屏幕上添加cutom疊加層。我添加了一個AvCaptureVidePreview圖層作爲AvCapture Session iphone 4s的全屏幕

AvCaptureVideoPreviewLayer*layer = [[AvCaptureVideoPreviewLayer alloc] iniWithSession:session]; 
layer.frame = self.view.layer.bounds; 

但在iPhone 4S的情況下,相機預覽不是全屏。它工作正常,在iPhone 5

回答

4
CGRect bounds=view.layer.bounds; 
layer.videoGravity = AVLayerVideoGravityResizeAspectFill; 
layer.bounds=bounds; 
layer.position=CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); 

可能是它可以幫助你..

+0

只是增加videogravity做的作品。謝啦..!!! – 2014-08-29 10:44:02