12

When you implement a cameraOverlayView for a UIImagePickerController, this view appears while you're taking the photo and after the photo has been taken, providing you with an opportunity to cancel or retake the photo. The problem I'm seeing is if your cameraOverlayView is on top of the photo preview area, when you take the photo and it shows you the preview, the photo you took doesn't align with the cameraOverlayView anymore. The entire photo preview pane has been moved down ~50 points while the cameraOverlayView has stayed in place. This is a problem when you need the photo to be aligned perfectly with the view.

How can this be adjusted so the two are perfectly aligned - while taking the photo and after it has been taken?

Notice how the whole preview area is pushed down after taking the photo.

enter image description here

Jordan H
  • 52,571
  • 37
  • 201
  • 351
  • I'm struggling with just the same problem and have already asked the question http://stackoverflow.com/q/30329523/1492708 Did you find any solution to your problem? – boweidmann May 20 '15 at 09:46
  • @BogdanWeidmann I did not, I ultimately had to resort to doing everything myself via AVFoundation. – Jordan H May 20 '15 at 15:21
  • Hi Joey, have you been able to implement also Photo Library photo picking functionality? Would you be so kind to share the steps and some code, how you've achieved this? I appreciate your time! :) – boweidmann May 20 '15 at 22:16
  • 1
    Looks like an Apple bug. I filed a radar, you might want to dupe it: http://www.openradar.me/30513073 – Ortwin Gentz Feb 14 '17 at 16:43

1 Answers1

1

I had a similar problem and came up with the following workaround:

if (IPhone5 || IPhone5c || IPhone5s)
{
     imagePicker.cameraViewTransform = CGAffineTransformTranslate(imagePicker.cameraViewTransform, 0, 30);
}
else if (IPhone6 || IPhone6Plus)
{
     imagePicker.cameraViewTransform = CGAffineTransformTranslate(imagePicker.cameraViewTransform, 0, 44);
}

This ensures that the picture that was taken will have approximately the same center as the camera preview layer (in portrait orientation).

Florin Pop
  • 171
  • 1
  • 9
  • this kind of work, but photo quality is altered. I have an OCR behind that is not working if I transforme camera view. :( – Vassily Jun 28 '16 at 09:26