I am trying to have a custom Camera Roll using AVFoundation, with square display and circular mask. In the ViewController, I added
UIView (for live preview of the camera)
UIImage (for captured photo)
UIImage (for the circular mask)
I used self.preview?.videoGravity = AVLayerVideoGravityResizeAspectFill
; so I achieved;
However, when I click on the 'TakePhoto', the UIImage for captured image bugs. It gets strecthed (and also inverted) and even though its constraints are locked to equal width & height to the PreviewUIView, so to me, it is supposed to get the right size.
Constraints of UIImage for the mask are same and works okay. But for the captured photo, its going behind the NavBar and also stretches to the bottom (even though the UIImage is selected AspectFill).
Maybe I am making a mistake with setting up the constraints. I'd be grateful for any help because I couldn't figure out what's causing the problem.