iPad横屏应用 时 图像旋转了90度
AVCaptureVideoPreviewLayer * layer = [AVCaptureVideoPreviewLayer layerWithSession:session];
layer.videoGravity=AVLayerVideoGravityResizeAspectFill;
UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
layer.orientation = UIInterfaceOrientationLandscapeLeft;
} else {
layer.orientation = AVCaptureVideoOrientationLandscapeRight;
}
这样修改时,图像恢复正常,但是有个警告
用layer
的connection
的 videoOrientation
属性
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
layer.connection.videoOrientation = UIInterfaceOrientationLandscapeLeft;
} else {
layer.connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
}
网友评论