自定义 iPhone 中的相机视图

发布于 2024-11-17 15:31:50 字数 1275 浏览 0 评论 0原文

提前致谢。 我想创建一个带有自定义相机视图的视图。像这样在此处输入图像描述

要在一个视图控制器中执行此操作,我有创建了另一个视图控制器的实例,在第二个视图控制器中我正在创建 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];

}

在第一个视图控制器中:

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)];

这实际上不起作用。是否是正确的流程。任何人都可以帮助我吗?

Thanks in advance.
I want to create a view with customizing camera view.Like thisenter image description here

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 .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魂ガ小子 2024-11-24 15:31:50

在 Sandhya 中,UIImagePickerController 有一个内置函数,通过名为cameraOverlayView 的属性实现此目的。

您可以分配视图,然后拥有

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。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文