4

I have a landscape iPad app and I present a UIImagePickerController with sourcetype UIImagePickerControllerSourceTypeCamera to my active view controller modally. However, the live preview is in the wrong orientation and when I take a picture with the wrong orientation, it outputs an image with the correct orientation.

When I rotate the iPad, it fixes the orientation but it makes a thick black bar on one of the sides of the screen depending on the orientation (the camera overlay view isn't cut off by this black bar... only the preview is).

Everything was fine with iOS5, but iOS6 messed up the camera.

How do I fix this live preview orientation bug?

DD_
  • 7,230
  • 11
  • 38
  • 59
Hamed Saadat
  • 429
  • 5
  • 8
  • I don't see the black bar, but I see the sideways live preview screen in ios7. Interestingly, I'm quite sure the problem was not present during testing but showed up when the app went live. I don't see how that is even possible. The post capture preview is oriented correctly. – Victor Engel Nov 12 '13 at 13:38
  • Hey bro +1 for your question. I am having that problem & stucked for a long time with this issue. Did u find any solution? – Leo Dec 27 '13 at 09:41
  • No solution. We just got rid of that feature. – Hamed Saadat Dec 28 '13 at 21:44

2 Answers2

1

In order to fix the black screen at the bottom of the screen, you have to do a translation and scale, based on the device(iPad or iPhone).

 CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 25.0);
    self.picker.cameraViewTransform = CGAffineTransformScale(translate, 480.0/380.0, 480.0/380.0); 
    self.picker.cameraOverlayView = self.view;

Try to change the scale values based on the device to make the black bar dissappear.

The X-Coder
  • 497
  • 6
  • 19
0

try this:

 dispatch_async(dispatch_get_main_queue(), ^{
  [self presentModalViewController:yourUIImagePickerControlle animated:YES];
 });
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132