Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8 Bug with UIImagePickerController Image Crop

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

like image 484
apphud Avatar asked Sep 23 '14 07:09

apphud


2 Answers

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

like image 67
nadirov Avatar answered Sep 29 '22 11:09

nadirov


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.

like image 37
mt81 Avatar answered Sep 29 '22 10:09

mt81