fuzzlog
fuzzlog

Reputation: 131

IOS Swift UIImagePickerController. How to access the bounds of the live camera feed?

Trying to create an app that uses the UIImagePickerController for its picture taking activities. I'm using a cameraOverlayView to accomplish this (for now, it just contains two buttons, one for Taking/Keeping the Picture and the other one for Canceling/Retaking). The steps below outline what is occurring.

  1. UIImagePickerController.view (with cameraOverlayView) is shown

![enter image description here

  1. I click "Shoot" and the imagePicker does its magic and I'm able to get an image out of it. However going past the image acquisition section (after I dismiss the custom view), the imagePicker goes onto "still" preview screen mode without any controls other than the "<" back button at the top of the screen. I'd like to avoid that and instead continue to use my custom view provided to the cameraOverlayView to handle "Keep/Retake" actions until I'm finished.

  2. As you can see in the image above, there is "black" band at the bottom of the view with my two custom buttons in it. I have no idea how the black band gets there since I did not add it. My custom View only has the two buttons.

  3. Attempting to add an UIImageView on the fly (to display a still preview of the image taken to the user while still keeping my action buttons) has the effect below .

enter image description here

The red arrow is pointing to an extra section below the UIImage I added after acquiring the picture data from the imagePicker.

That section is actually displaying the live preview the imagePicker is constantly producing.

What I'd like to accomplish is to be able to get the bounds of that live preview section being displayed so I can calculate the correct bounds of the UIImage I'm adding on the fly since getting the height correctly will absolutely fail when ported to different devices.

Any suggestions?

Upvotes: 2

Views: 791

Answers (0)

Related Questions