iOS做自定义拍照的时候图像选择90度,为了契合iPad的拍照

可以通过获取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];

说点什么

avatar
  Subscribe  
提醒