dks1725
dks1725

Reputation: 1631

How to capture whole screen with camera in iPhone?

I have an application in which i open camera without camera controls and i used my custom controls.
Now i want that camera capture whole screen and my custom controls display in front of camera view but don't know how to do that.
Below is my code

-(void) cameraOpen
{
    imgpicker=[[UIImagePickerController alloc]init];
    imgpicker.delegate=self;
    imgpicker.sourceType=UIImagePickerControllerSourceTypeCamera;
    imgpicker.showsCameraControls=FALSE;
    imgpicker.wantsFullScreenLayout=TRUE;

    UIView *newView=[[UIView alloc] initWithFrame:CGRectMake(0,416,320,480)];
    newView.backgroundColor=[UIColor clearColor];
    [newView addSubview:cameraOptionView];
    imgpicker.cameraOverlayView=newView;

    [self presentModalViewController:imgpicker animated:YES];
}

What happen currently is at bottom it shows white space and my new view in that space.
I want whole screen captured by camera and my custom view for controls should on front of camera.
Thanks in advance.

Upvotes: 0

Views: 436

Answers (1)

gcamp
gcamp

Reputation: 14662

You can't have a full screen camera since the the camera aspect ratio (4:3) is not the same as the one as the screen (2:3).

You can however, stretch the image so that it will fill the screen. I do not recommend that, since the image will probably not look right. For that, you'll use AV Foundation, AVCaptureVideoPreviewLayer in particular.

Upvotes: 1

Related Questions