2

I am trying to add a cameraOverlayView on a UIImagePickerController, but I want the overlay to cover just the part of the screen that shows what will be captured by the camera, not the "Cancel" button, take photo button, flash settings, or anything like that. How can I dynamically determine what the frame of the UIImageView of my overlay should be?

I've attached an image to illustrate exactly the section I'm talking about.

enter image description here

sethfri
  • 1,307
  • 1
  • 15
  • 31

2 Answers2

6

you can use AVCamCaptureManager to get overlay which cover just the part of the screen that shows what will be captured by the camera only , not buttons

Piyushkumar
  • 418
  • 4
  • 10
0

i had same situation, what i did, i created an UIImageView like follow:

    myview                 = [[UIImageView alloc]init];
    myview.frame            =  CGRectMake(0, 68, 320, 430);
// note that these frames were as per my needs, you can manipulate them as per yours.

then add this image view as

myImagePicker.cameraOverlayView   = myview;

try this with setting some background color and check whether its covering entire camera part or not, you would just need to set frames, thats all!!!

And yes it does work!

Rana
  • 451
  • 4
  • 16
  • 2
    Yes, I realize that setting the `frame` is the solution. What I'm wondering is how to **dynamically** calculate the `frame`, as opposed to just figuring out magic numbers. – sethfri Apr 24 '14 at 18:53
  • I have managed to add an overlayview but the problem is , when I am taking the picture i just want to take the part inside the overlayView. Did you managed to do that ? https://stackoverflow.com/a/56187599/8732045 – Assegd May 20 '19 at 12:10