UIImagePickerControllerSourceTypePhotoLibrary绕过imagePickerControllerDidCancel并忽略allowEditing

时间:2014-06-03 17:57:20

标签: ios uiimagepickercontroller

我正在使用带有自定义overylay视图的imagePicker,其中包含照片库的按钮等。我正在实例化它:

_overlay = [[CameraWithOverlayViewController alloc]initWithNibName:@"OverlayView" bundle:nil];
_overlay.delegate = self;

_imagePicker = [[UIImagePickerController alloc] init];
_imagePicker.delegate = self;
_imagePicker.allowsEditing = NO;
_imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
_imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
_imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
_imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
_imagePicker.showsCameraControls = NO;
_imagePicker.navigationBarHidden = YES;
_imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;

_imagePicker.cameraOverlayView = _overlay.view;

并以模态呈现。 CameraWithOverlayViewController报告覆盖按钮通过委托协议回复给我,然后我用它来拍摄照片,切换到照片库或取消图片标签。

当用户点击照片库按钮时,我正在运行:

imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

调出照片库而不是相机。

问题一是,当您使用自定义相机覆盖视图时,绕过imagePicker.allowsEditing布尔属性,这意味着我必须构建自己的裁剪视图。但即使设置了imagePicker.allowsEditing = NO,照片库也会将我发送到裁剪视图。

第二个问题是,尽管已将自己设置为imagePicker的委托,并实现了委托协议/方法,但照片库视图上的取消按钮并未调用- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker,因此我无法使用该方法如果用户从照片库中取消,则将用户放回相机屏幕。

非常感谢任何见解!

0 个答案:

没有答案