Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS7 UIImagePickerController allowsEditing not working correctly

In someViewController:

UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.delegate = self;

    [self presentViewController:picker animated:YES completion:^{

    }];

I take a photo and get to the next screen where (due to allowsEditing = YES;) I have an option to crop my photo into square shape. White square rectangular appears on an initial position over the photo I've taken and I try to move it around. I can drag it, but every time I release the finger, it goes back to the position it held initially. The are no glitches. When I release the finger, white framed rectangular animates with easeOut animation back to the position where I dragged it from.

It is not the same as if allowsEditing is set to NO. If it is set to NO, than a cropping rectangle does not even appear.

Previously, I thought that the problem appears only on iOS 7, but now I realise that it happens on all iOS versions. I don't understand how this happened, but it started when I started using Xcode 5 and building for iOS7. I kept Xcode 4.6.3 on my Mac so I tried to build this app again with the older Xcode, but it did not fix anything.

I also need to mention that when I load an image from photo library, cropping works fine, like it is supposed to. I have problems only when taking a new photo.

Furthermore, when initial crop rectangle appears, although I am unable to drag that rectangle around the photo, I can still zoom in and out. When I zoom in, I can then drag this (smaller) cropping rectangle around the photo but ONLY within boundaries of initial rectangle's position & size. If I cross that boundary, my cropping rectangle animates back to the inside of the invisible boundaries.

Anyone, please help...

like image 954
ancajic Avatar asked Oct 07 '13 16:10

ancajic


1 Answers

It seems like this is a bug with UIImagePickerController. I was trying to figure out what I did wrong. But then I started a couple of blank new projects just to test this functionality. I also checked out the Apple's official sample code:

https://developer.apple.com/library/ios/samplecode/photopicker/Introduction/Intro.html

like image 71
ancajic Avatar answered Oct 29 '22 22:10

ancajic