代码之家  ›  专栏  ›  技术社区  ›  Raj Pawan Gumdal

相机快门打开事件的回调

  •  2
  • Raj Pawan Gumdal  · 技术社区  · 15 年前

    我一直在uiImagePickerController中工作,遇到一个问题,我需要获得当源类型设置为相机(uiImagePickerController源类型相机)时,uiImagePickerController中相机快门打开时的精确时刻。

    我在网上搜索了一下,发现没有人有这么奇怪的要求!

    我查看了uiImagePickerController和uiImagePickerControllerDelegate的文档,希望获得指示相机快门打开事件的委托方法/回调,但没有找到任何。

    有什么建议吗?

    谢谢你的帮助,

    拉吉帕万

    3 回复  |  直到 12 年前
        1
  •  2
  •   Jacob Jennings    12 年前

    订阅:

    AVCaptureSessionDidStartRunningNotification
    

    这是虹膜打开动画开始的时候。如果在这段时间内添加一个cameraOverlay视图,它将被虹膜正确覆盖。它与“私人通知”同时发布。这是一种记录在案的方法,不会有拒绝应用程序的风险。

        2
  •  1
  •   Community CDub    8 年前

    解决方案是观察私有通知,正如本线程中讨论的那样: Detecting when camera's iris is open on iPhone .

        3
  •  0
  •   yonel    15 年前

    我的建议(我自己没试过,但不明白为什么不起作用):。

    • uiImagePickerController子类划分为您自己的类,并重写viewWillAppear和viewDidAppear:当uiImagePickerController即将出现或确实出现时,将触发这些方法(如果您使用 presentModalController正确触发其显示)。.

    >
    @接口myuiImagePickerController:uiImagePickerController{
    }
    @结束
    
    实现myuiImagePickerController
    -(void)视图将显示:(bool)动画{
    nslog(@“选取器即将出现”);
    [超级视图将显示:动画];
    }
    
    -(void)视图显示:(bool)动画{
    nslog(@“选择器确实出现”);
    [超级视图显示:动画];
    }
    @结束
    < /代码> 
    
    

    .>.

    
    @接口myuiImagePickerController:uiImagePickerController{
    }
    @结束
    
    
    @implementation MyUIImagePickerController
    -(void)viewWillAppear:(BOOL)animated {
        NSLog(@"the picker is about to appear");
        [super viewWillAppear:animated];
    }
    
    -(void)viewDidAppear:(BOOL)animated {
        NSLog(@"the picker did appear");
         [super viewDidAppear:animated];
    }
    @end