I'm going to feel dumb but I've searched everywhere and have not found an answer. I've been able to pull up the "edit" view using the default camera's controls. However I threw an overlay on it and I have a UIButton hooked up to IBAction take photo which looks like [UIImagePickerController takePicture].
However, it totally skips the editing part even though I set allows editing to YES. Is there another command to call it? Right now, it just goes straight to didFinishPickingMediaWithInfo.
camera.sourceType = UIImagePickerControllerSourceTypeCamera;
camera.cameraDevice = UIImagePickerControllerCameraDeviceRear;
camera.showsCameraControls = NO;
camera.navigationBarHidden = YES;
camera.toolbarHidden = YES;
camera.wantsFullScreenLayout = NO;
camera.allowsEditing = YES;
camera.cameraOverlayView = overlay;
[self presentViewController:camera animated:YES completion:nil];
then in IBAction
[camera takePicture];
Possible duplicate: UIImagePickerController does not show edit screen
According to takePicture: method in Apple documentation:
Use this method in conjunction with a custom overlay view to initiate the programmatic capture of a still image. This supports taking more than one picture without leaving the interface, but requires that you hide the default image picker controls.
Calling this method while an image is being captured has no effect. You must wait until the associated delegate object receives an imagePickerController:didFinishPickingMediaWithInfo: message before you can capture another picture.
It seems that this approach (custom overlay) it is configured in order to be managed by yourself. Even if "allowsEditing = YES" the taken picture will be directly sent to imagePickerController:didFinishPickingMediaWithInfo:.
Based on that if we want to edit the taken picture using our custom user interface we should create an according custom edit screen for that purpose.
For future reference:
The problem of not showing the Edit screen is associated with the camera.showCameraControls = NO; the presence or absence of overlay has nothing to do with it (as the current accepted answer states)
Possible workaround: on your IBAction [camera takePicture] set them again to YES. They will be shown only for a fraction of a second and that will allow the edit screen to appear. Then you will have a problem when hitting "Retake", in that case you have to capture that action via delegate and hide them again there.
来源:https://stackoverflow.com/questions/17184224/how-do-i-use-camera-takephoto-and-edit-using-uiimagepicker-uiimagepickercont