iOS5中的AVCaptureSession预览屏幕方向

iOS5中的AVCaptureSession预览屏幕方向,ios,ios5,orientation,avcapturesession,avcapture,Ios,Ios5,Orientation,Avcapturesession,Avcapture,我问了一会儿。我接受了答案,因为它奏效了。。。直到我在iOS5上试过 我的应用程序只是横向的。打开相机预览并按住设备右侧的“主页”按钮,预览中的图像将显示在右侧。拍照后,拍摄的图像具有正确的方向。这只是一个90度的预览。这解决了ios6的问题: AVCaptureConnection *previewLayerConnection=self.previewLayer.connection; if ([previewLayerConnection isVideoOrientationSupp

我问了一会儿。我接受了答案,因为它奏效了。。。直到我在iOS5上试过

我的应用程序只是横向的。打开相机预览并按住设备右侧的“主页”按钮,预览中的图像将显示在右侧。拍照后,拍摄的图像具有正确的方向。这只是一个90度的预览。这解决了ios6的问题:

AVCaptureConnection *previewLayerConnection=self.previewLayer.connection;

  if ([previewLayerConnection isVideoOrientationSupported])
    [previewLayerConnection setVideoOrientation:[[UIApplication sharedApplication] statusBarOrientation]];

但是,对于运行iOS5的设备,如何解决这个定向问题呢?AVCaptureVideoPreviewLayer连接仅在iOS6中可用。

请尝试AVCaptureVideoPreviewLayer.orientation