问题
I saw this question here: UIImagePicker allowsEditing stuck in center
It seems someone had this problem before, but there's no clear resolution.
Reproduction steps:
- Set allowsEditing = YES
- Take a picture
- Crop window comes up, but everytime I pan the image, it just snaps back to the center.
I'm on iOS 7.0.3.
Here's my code:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:nil];
回答1:
You just need to write bellow single line of code.
UIImage *image = [info valueForKey:UIImagePickerControllerEditedImage];
回答2:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES; // YES
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
try this i think you are missing the UIImagePickerControllerSourceTypeCamera on the sourceType. see if it works.
来源:https://stackoverflow.com/questions/20000273/uiimagepickercontroller-with-allowsediting-doesnt-allow-panning-to-crop