iOS AVCaptureDevice 图像90度问题

可以通过获取AVCaptureConnection,然后调用setVideoOrientation:方法解决图像90°问题。

比如:显示AVCaptureVideoPreviewLayer
[[_videoPreviewLayer connection] setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];

拍照,输出用AVCaptureStillImageOutput时,
outputPic = [[AVCaptureStillImageOutput alloc]init];
AVCaptureConnection * videoConnection = [outputPic connectionWithMediaType:AVMediaTypeVideo];
[videoConnection setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];

摄像,输出用AVCaptureMovieFileOutput时,
outputMovie = [[AVCaptureMovieFileOutput alloc] init]; 
AVCaptureConnection * videoConnection = [outputMovie connectionWithMediaType:AVMediaTypeVideo];  
[videoConnection setVideoOrientation :AVCaptureVideoOrientationLandscapeRight];

你可能感兴趣的:(iOS)