On my app I have a cameraOverlayView
over my open camera with custom controls for the camera buttons. The app allows the user to take several pictures before closing the camera, so the shutter button does not call dismissViewControllerAnimated
, instead there's a close button for when you're done taking pictures.
Now, one of the buttons on the camera overlay is a gallery button to allow the user to pick a saved image instead of shooting a new one. I've tried two different approaches to make this work, both failed.
First approach
Use the same UIImagePickerController
instance that is currently presenting the overlay and switch the sourceType
to library. It does present the gallery then, but when a photo is tapped, I can't dismiss the galley without dismissing the whole overlay.
Second approach
Create a separate instance of UIImagePickerController
, set the sourceType
to gallery and attempt to call presentViewController
, which then fails with the warning:
"Warning: Attempt to present on whose view is not in the window hierarchy!"
Does anyone have a solution for this issue? Is this even possible?