UIImagePickerController 中的 takePicture 方法不会每次都立即拍照

发布于 2024-09-15 15:50:24 字数 461 浏览 3 评论 0原文

我有一个相机应用程序,它在 UIImagePickerController 对象上使用我的自定义叠加层。

当用户按下叠加视图上的按钮时,我调用 takePicture 方法来拍照。类似于:

[imagePicker takePicture];
[self showProcessingIndicator];

处理指示器是通常的旋转轮,显示正在拍摄照片。我注意到,在调用 takePicture 方法后,相机通常不会立即拍照,并且会显示处理指示器。

相机似乎会尝试调整焦点(如果失焦),然后拍照。这可能是正确的做法。然而,我也注意到即使相机正确对焦并且不改变焦点,拍照也会出现延迟。这种情况并不是每次都会发生,而且很难说具体是什么时候发生的。

我的问题是:有没有办法强制相机立即拍照,而忽略其他一切?另外,后续处理(例如显示指示器视图)是否可能导致相机有时响应速度变慢?

谢谢!

I have a camera application that uses my custom overlay on the UIImagePickerController object.

I am calling the takePicture method to take a picture when the user presses a button on my overlay view. Something like:

[imagePicker takePicture];
[self showProcessingIndicator];

The processing indicator is the usual spinning wheel that shows that a picture is being taken. I notice that often the camera does not take a picture immediately after the takePicture method is called, and the processing indicator is showing.

It seems that the camera tries to adjust its focus (if it is out of focus) and then takes a picture. This is probably the right thing to do. However, I have also noticed delay in taking a picture even when the camera is focused correctly and does not change its focus. This does not happen every time, and its hard to say when exactly it happens.

My question is: is there a way to force the camera to take a picture instantly, ignoring everything else? Also, is it possible that subsequent processing (showing the indicator view, for example) is causing the camera to respond slower on occasion?

Thanks!

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

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

发布评论

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

评论(1

风追烟花雨 2024-09-22 15:50:24

我也看到了这一点,并得出结论,就与相机设备通信、分配/移动内存等而言,拍照是一项相当消耗资源的操作。虽然您可以调整应用程序,使其不占用任何资源,但这段代码正在运行,您无法告诉 MobileMail、MobileiTunes 等在该时刻检查电子邮件等。

是否有任何特定的 iOS 版本或设备比其他版本或设备更容易发生这种情况?在装有 iOS 4.0.x 的 iPhone 3G 上拍照最多需要 30 秒,但在 iPhone 4 上有了很大改善。

活动指示器会占用一些资源,因此这可能是删除的候选者,也许只需使用声音即可。测试一下以确定。

I have also seen this and came to the conclusion that taking a picture is a reasonably resource-hungry operation in terms of talking to the camera device, allocating/moving memory, etc. While you can tune your application to not soak up any resources while this piece is running, you can't tell MobileMail, MobileiTunes, etc, to not check for email, etc, at that precise moment.

Is there any particular iOS version or device that this happens on more than others? Taking a picture on my iPhone 3G with iOS 4.0.x took up to 30 seconds, but is much improved on iPhone 4.

The activity indicator will soak up some resources, so this may be a candidate for removal and maybe just use sound instead. Test to be sure.

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