UIImagePickerController with allowsEditing doesn't allow panning to crop

拈花ヽ惹草 提交于 2019-12-23 06:48:45

问题


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:

  1. Set allowsEditing = YES
  2. Take a picture
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!