Customize the camera view in iphone
Thanks in advance. I want to create a view with customizing camera view.Like this
To do this in one view controller I have created开发者_开发百科 the instance of another view controller and in the second viewcontroller i am creating UIImagepickerController like this:
-(void)showCamera
{
camController = [[UIImagePickerController alloc]init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
camController.sourceType = UIImagePickerControllerSourceTypeCamera;
}
camController.showsCameraControls = NO;
camController.navigationBarHidden = YES;
camController.toolbarHidden = YES;
camController.wantsFullScreenLayout = NO;
camController.cameraViewTransform = CGAffineTransformScale(camController.cameraViewTransform, 2.0f, 2.0f);
// Edited
//[self presentModalViewController:camController animated:YES];
}
and in the first view controller :
cam = [[CamController alloc]init];
cam.view.frame = CGRectMake(5, 50, 310, 300) ;
[cam showCamera];
[self.view addSubview:cam.view];
//Edited
[self.cam presentModalViewController:self.cam.camController animated:NO];
[self performSelector:@selector(setFrame) withObject:self afterDelay:1.0];
[self.cam.camController.view setFrame:CGRectMake(10, 50, 300, 250)];
This is not working actually. Is it correct process. Can any one help me .
sandhya , UIImagePickerController has has a built in function for this by the property called cameraOverlayView.
You could alloc the view and then have
UIImagePicker *camPicker; // alloc camera picker here bla bla bla
CameraView *camview = [[CameraView alloc] initWithNibName:@"CameraView" bundle:nil];
camPicker.cameraOverlayView = camview.view;
camPicker.showsCameraControls = NO;
Shai.
精彩评论