Search code examples
iosswiftuiimagepickercontroller

UIImagePickerController detecting when photo goes into edit mode


I've added a custom button to UIImagePicker like below:

enter image description here

It is just an UIButton set as the overlay view. However when the camera goes into the edit mode the button is in the way:

enter image description here

Is there anyway to detect the shutter button has been pressed? That way I could just hide the button. I know I can use func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject])

however this is AFTER "Use Photo" has been tapped. I need to detect before the edit view comes in. Any pointers on this would be great.


Solution

  • With default UIImagePickerView, its not possible.

    You don't get notified when the user taps the button but you can provide your own capture button

    Hide its standard image picker controls (showsCameraControls) and provide a custom overlay view (cameraOverlayView). In that overlay view, place a custom button that you connect to a target/action.