【问题标题】:iPhone Camera Overlay issueiPhone相机覆盖问题
【发布时间】:2013-02-06 07:43:41
【问题描述】:

我在我的 iPhone 应用程序中为相机使用自定义叠加,我遵循了 this 教程。 我的问题是 - 覆盖在快门打开之前出现,意味着用户可以在快门上看到覆盖项(按钮、图像等)

我试过用计时器来延迟快门打开动画时的叠加外观,但这不是正确的方法。

有更好的主意吗?

-(void)onShowCam
{
   NSLog(@"sdadas");

    overlay = [[CustomOverlayView alloc]
           initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];

    overlay.delegate = self;

   .....

【问题讨论】:

    标签: iphone ios camera overlay


    【解决方案1】:

    尝试使用这个

        cameraOverlay=[[ImagePickerController alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH)];
             imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
             imagePicker.delegate=self;
             imagePicker.showsCameraControls=NO;
             imagePicker.cameraFlashMode=UIImagePickerControllerCameraFlashModeOff;
             [imagePicker setCameraOverlayView:cameraOverlay];
    
    //Show camera
             [self presentModalViewController:imagePicker animated:YES];
    

    【讨论】:

      【解决方案2】:

      在 iPad 上不存在这个问题,并且默认情况下覆盖视图在快门动画的后面。但在 iPhone 上,覆盖显示在前面。

      我找到了适合我的解决方案。

      您必须在此方法中将叠加视图设置为子视图:

      - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
          if (!viewController)
              return;
      
          UIView* controllerViewHolder = viewController.view;
          UIView* controllerCameraView = [[controllerViewHolder subviews] objectAtIndex:0];
          UIView* controllerPreview = [[controllerCameraView subviews] objectAtIndex:0];
          [controllerCameraView insertSubview:self.overlayView aboveSubview:controllerPreview];
      }
      

      希望对你有帮助

      原文出处: http://www.alexcurylo.com/blog/2009/06/18/uiimagepickercontroller-in-3-0/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-11-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多