简体   繁体   中英

UIImagePickerController with allowsEditing doesn't allow panning to crop

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];

你只需要写下单行代码。

UIImage *image = [info valueForKey:UIImagePickerControllerEditedImage];
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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM