I know many people had asked this question, but I am not found some correct answer to fix this issue,My problem is : How can I make the photo on preview view(after user tap the capture button,and then go to the preview view to let the user preview) not mirror, can this prossible fix in UIImagePickerController, I know how to rotate the photo , something in enum in UIImageOrientation
like UIImageOrientationUp
, I know what this mean.
Try 1:
I attend to get the photo after user tap capture button before go to the preview view and use the photo which I have mirror to cover the default photo (use cameraOverlayView
), I can detect the user tap the capture button use NSNotificationCenter
with @"_UIImagePickerControllerUserDidCaptureItem", but I find no way to get the photo.
Try 2:
I use cameraViewTransform
, but when user take photo (front camera) when the Home button on the bottom or top, the image on preview view is not mirror, but when the Home
button on the left or right, the image on phone have some problem before user tap the capture, although the image on the preview view is not mirror.use AVCaptureDeviceDidStartRunningNotification
notification.
- (void)cameraChanged:(NSNotification *)notification
{
if(self.imagePickerController.cameraDevice == UIImagePickerControllerCameraDeviceFront)
{
self.imagePickerController.cameraViewTransform = CGAffineTransformIdentity;
self.imagePickerController.cameraViewTransform = CGAffineTransformScale(self.imagePickerController.cameraViewTransform, -1, 1);
if (self.imagePickerController.cameraOverlayView) {
NSLog_DEBUG(@"self.imagePickerController.cameraOverlayView is not nil");
} else {
NSLog_DEBUG(@"self.imagePickerController.cameraOverlayView is nil");
}
self.imagePickerController.cameraOverlayView.transform = CGAffineTransformScale(self.imagePickerController.cameraViewTransform, -1, 1);
} else {
self.imagePickerController.cameraViewTransform = CGAffineTransformIdentity;
}
}