UIImagePickerController with allowsEditing不允许平移裁剪
我在这里看到这个问题: UIImagePicker允许Editing卡在中心
看来以前有人有这个问题,但是没有明确的解决办法。
复制步骤:
- 设置allowsEditing = YES
- 拍一张照片
- 裁剪窗口出现,但每次我平移图像,它只是回到中心。
我在iOS 7.0.3上。
这是我的代码:
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];
尝试这个我认为你是缺less的sourceType的UIImagePickerControllerSourceTypeCamera。 看看它是否有效。