iOS做自定義拍照的時候影象選擇90度,為了契合iPad的拍照
阿新 • • 發佈:2019-02-17
可以通過獲取AVCaptureConnection,然後呼叫setVideoOrientation:方法解決影象90°問題。 比如:顯示AVCaptureVideoPreviewLayer
[[_videoPreviewLayer
connection]
setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];
拍照,輸出用AVCaptureStillImageOutput時,
攝像,輸出用AVCaptureMovieFileOutput時,outputPic = [[AVCaptureStillImageOutput alloc]init]; AVCaptureConnection * videoConnection = [outputPic connectionWithMediaType:AVMediaTypeVideo]; [videoConnection setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];
outputMovie
= [[AVCaptureMovieFileOutput alloc] init];
AVCaptureConnection
* videoConnection = [outputMovie connectionWithMediaType:AVMediaTypeVideo];
[videoConnection
setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];
檢視原文:https://www.liuandy.cn/ios/2018/01/19/2281.html