1 , 自定义相机,拿到照片,校正方向
AVCapturePhotoCaptureDelegate 的这个代理方法
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?)
拿照片,
extension ZLCustomCamera: AVCapturePhotoCaptureDelegate {
public func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
if error != nil {
return
}
if let imgData = photo.fileDataRepresentation(){
self.session.stopRunning()
if let img = UIImage(data: imgData){
self.takedImage = img.fixOrientation()
}
self.takedImageView.image = self.takedImage
self.takedImageView.isHidden = false
self.resetSubViewStatus()
}
}
}
拿到照片后,让照片的头部朝上
extension UIImage {

本文介绍了在iOS中自定义相机时如何处理照片旋转的问题,包括获取照片后进行校正方向,根据分辨率调整图片视图大小并指定中心点,记录旋转角度以便重拍时恢复,以及最后如何结束旋转并生成最终正确方向的照片。
最低0.47元/天 解锁文章
856

被折叠的 条评论
为什么被折叠?



