开发者

takePicture method in UIImagePickerController does not take a picture instantly every time

开发者 https://www.devze.com 2023-01-12 14:42 出处:网络
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

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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号