相机快门打开事件的回调

发布于 2024-08-22 13:25:33 字数 332 浏览 5 评论 0原文

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

我做了一些谷歌搜索,发现没有人有如此奇怪的要求!

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

有什么建议吗?

感谢您的帮助,

拉吉·帕万

I have been working around in UIImagePickerController and am struck with a problem where I need to get the precise moment when the camera shutter opens in UIImagePickerController when the source type is set to camera (UIImagePickerControllerSourceTypeCamera).

I have done some googling around and have realized that no one had such strange requirement!

I looked around the docs of UIImagePickerController and UIImagePickerControllerDelegate hoping to get some delegate method / callback indicating the camera shutter open event, but did not find any.

Any suggestions?

Thanks for any help,

Raj Pawan

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

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

发布评论

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

评论(3

荒岛晴空 2024-08-29 13:25:33

订阅:

AVCaptureSessionDidStartRunningNotification

这是虹膜打开动画开始的时间。如果你在这段时间添加一个cameraOverlayView,它将被虹膜正确遮盖。它与 PL…私人通知同时发布。这是一种记录在案的方法,不会带来应用程序被拒绝的风险。

Subscribe to:

AVCaptureSessionDidStartRunningNotification

This is when the iris open animation begins. If you add a cameraOverlayView during this time, it will be properly covered up by the iris. It is posted at the same time as that PL… private notification. This is a documented approach that does not risk app rejection.

陌上芳菲 2024-08-29 13:25:33

解决方案是观察私有通知,正如本线程中讨论的那样:
检测 iPhone 上相机光圈何时打开

The solution is to observe for a private notification, just as discussed in this thread:
Detecting when camera's iris is open on iPhone.

横笛休吹塞上声 2024-08-29 13:25:33

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

  • UIImagePickerController 类子类化为您自己的类,并覆盖 viewWillAppear 和 viewDidAppear :这些方法将被触发当 UIImagePickerController 即将出现或确实出现时(例如,如果使用 presentModalController 正确触发其显示)。

    @interface MyUIImagePickerController : UIImagePickerController {
    }
    @end

@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

<代码>

My sugestion (didn't try it myself but don't see why it wouldn't work) :

  • Subclass the UIImagePickerController class into your own class, and override the viewWillAppear and viewDidAppear : those methods will be triggered when the UIImagePickerController is about to appear or does appear (if you trigger its display properly using presentModalController for instance) .


@interface MyUIImagePickerController : UIImagePickerController {
}
@end

@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

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