11

I am having an issue with UIImagePickerController with allowsEditing = YES. I am unable to crop the image from the bottom but also I have an extra empty space on top when moving the crop rectangle.

Also in the method.

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

I log info and it gives me wrong CropRect (which is not square!)

UIImagePickerControllerCropRect = "NSRect: {{0, 357}, {666, 646}}";
UIImagePickerControllerEditedImage = "<UIImage: 0x7f9b8aa47b30> size {640, 618} orientation 0 scale 1.000000";
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x7f9b8868e5a0> size {1500, 1001} orientation 0 scale 1.000000";

Does anyone has this bug and how do you fix it?

See the picture below Unable to select the bottom part of image

apphud
  • 625
  • 4
  • 8

2 Answers2

4

I have no idea how, but i totally removed "View controller-based status bar appearance" key row (just fully delete this row) in .plist file and it fixed this bug

nadirov
  • 62
  • 4
  • thanks this actually solved my problem . i knew issue is with status bar but dint know where to change . – ishhhh Oct 27 '14 at 08:54
  • But this enables status bar in all the views. is there any other option? – ishhhh Oct 27 '14 at 09:47
  • 1
    may be this will help http://stackoverflow.com/questions/18880364/uiimagepickercontroller-breaks-status-bar-appearance – nadirov Oct 27 '14 at 15:02
  • The only issue with this solution, though it solves this problem, it creates a new one which is the status bar is visible and you can see the battery and time. Does anyone here knows how to sort this out? – rcat24 May 25 '15 at 07:58
1

I couldn't set the "View controller-based status bar appearance" to YES, so I have tried to hide the status bar when I show the UIImagePickerController like so:

 let imagePickerController = UIImagePickerController()

 ... 

 myViewController.present(imagePickerController, animated: true) {
     UIView.animate(withDuration: 0.25, animations: {
         UIApplication.shared.isStatusBarHidden = true
     })
 } 

Then on the UIImagePickerControllerDelegate didFinishPickingMediaWithInfo I show the status bar, and it worked.

mt81
  • 3,288
  • 1
  • 26
  • 35