I have a UIImagePickerController and a cameraOverlayView, however when the user takes a picture, the cameraOverlay view persists in the 'Preview/Use photo/retake photo view'.
Is there a way to define a cameraOverlayView for just the first camera view?
Just posting here for future references, if anyone needs it.
I've been having the same issue, and after a day of research, with a lot of trail and error, I found a way that removes the cameraOverlayView from the image preview.
When you take a photo the "_UIImagePickerControllerUserDidCaptureItem" triggers. Luckily we can utilize this by creating an observer with a closure. Inside the closure we can set the cameraOverlayView to nil, and thereby removing your custom view before entering preview.
This works in Xcode Version 8.1 (8B62), with Swift 3.
I have added the code snippet for you to utilize if needed.
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: "_UIImagePickerControllerUserDidCaptureItem"), object:nil, queue:nil, using: { note in
self.imagePicker.cameraOverlayView = nil
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With