AVCapture - AVCaptureVideoPreviewLayer 横屏方向问题

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;
    }

这样修改时,图像恢复正常,但是有个警告


layerconnectionvideoOrientation属性

if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
         layer.connection.videoOrientation = UIInterfaceOrientationLandscapeLeft;
    } else {
         layer.connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
    }

你可能感兴趣的:(AVCapture - AVCaptureVideoPreviewLayer 横屏方向问题)