简体   繁体   English

在 iphone 中自定义相机视图

[英]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:要在一个视图 controller 中执行此操作,我已经创建了另一个视图 controller 的实例,并且在第二个视图控制器中,我正在创建 UIImagepickerController,如下所示:

-(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:在第一个视图中 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. Sandhya,UIImagePickerController 有一个内置的 function 由名为 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.谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM