Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions SCCaptureCameraDemo/SCCaptureCamera/SCCaptureSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,28 @@ - (void)takePicture:(DidCapturePhotoBlock)block {

UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
if (orientation != UIDeviceOrientationPortrait) {

CGFloat degree = 0;
if (orientation == UIDeviceOrientationPortraitUpsideDown) {
degree = 180;// M_PI;
} else if (orientation == UIDeviceOrientationLandscapeLeft) {
degree = -90;// -M_PI_2;
if ([self.inputDevice.device position] == AVCaptureDevicePositionBack) {
degree = -90;// -M_PI_2;
} else {
degree = 90;
}
} else if (orientation == UIDeviceOrientationLandscapeRight) {
degree = 90;// M_PI_2;
if ([self.inputDevice.device position] == AVCaptureDevicePositionBack) {
degree = 90;
} else {
degree = -90;
}
}
croppedImage = [croppedImage rotatedByDegrees:degree];
}

// self.imageView.image = croppedImage;

if([self.inputDevice.device position] == AVCaptureDevicePositionFront){
//前置摄像头拍摄,将照片镜像
croppedImage = [UIImage imageWithCGImage:croppedImage.CGImage scale:croppedImage.scale orientation:UIImageOrientationUpMirrored];
}
//block、delegate、notification 3选1,传值
if (block) {
block(croppedImage);
Expand Down