简体   繁体   English

带allowEditing的UIImagePickerController不允许平移裁剪

[英]UIImagePickerController with allowsEditing doesn't allow panning to crop

I saw this question here: UIImagePicker allowsEditing stuck in center 我在这里看到了这个问题: UIImagePicker允许编辑卡在中心

It seems someone had this problem before, but there's no clear resolution. 似乎有人之前有这个问题,但没有明确的解决方案。

Reproduction steps: 复制步骤:

  1. Set allowsEditing = YES 设置allowEditing = 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. 我在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. 试试这个我认为你缺少sourceType上的UIImagePickerControllerSourceTypeCamera。 see if it works. 看看它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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