1

Is there a way to prep the camera any faster when presenting UIImagePickerController?

This question addresses that there is indeed a delay, as well as a way to receive a callback when the camera is ready How to know if iPhone camera is ready to take picture?

I know this must be possible (snapchat, instagram, etc) all have quite seamless UI's in terms of picture-taking.

I currently just present my imagepicker like so:

    _imagePicker = [[UIImagePickerController alloc] init];
    _imagePicker.delegate = self;
    _imagePicker.allowsEditing = YES;
    _imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    _imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
    [self presentViewController:_imagePicker animated:NO completion:NULL];
Community
  • 1
  • 1
Apollo
  • 8,874
  • 32
  • 104
  • 192
  • It seems you answer your own question no ? using the notification center as suggested in your post's [link](http://stackoverflow.com/questions/10678067/how-to-know-if-iphone-camera-is-ready-to-take-picture) – Starscream May 16 '14 at 22:34
  • 1
    You could set up the image picker before the user tries to take a picture. This wouldn't truly be "faster", but it would appear so to the user. – 67cherries May 16 '14 at 22:36
  • @MathieuMeylan no. a delegate callback is not the same as increased speed whatsoever. – Apollo May 17 '14 at 00:54
  • @68cherries well how would I go about doing that? – Apollo May 17 '14 at 00:56

2 Answers2

1

I do not think is possible, unless you start to build your own photo picker using AVFoundation and capture movies and photo from there. Build a good photo picker from scratch with the same functionalities is quite expensive task. There are some examples around, the apple AVCam is probably the most complete. You can use it as a benchmark and see how is faster than the uiimagepickercontroller

Andrea
  • 26,120
  • 10
  • 85
  • 131
0

Try to setup the camera before the user tries to take a photo. As I mentioned before, this is not truly faster, but will appear so to the user.

This code will set up the camera asynchronously:

Add __block before the UIImagePickerController in _imagePicker's declaration.

NSOperationQueue *cameraSetupQueue = [[NSOperationQueue alloc] init];
cameraSetupQueue.name = @"camera setup";

[cameraSetupQueue addOperationWithBlock:^(void){

    _imagePicker = [[UIImagePickerController alloc] init];
    _imagePicker.delegate = self;
    _imagePicker.allowsEditing = YES;
    _imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    _imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
}];

Put this code somewhere so that it will be executed before the camera needs to be used.

67cherries
  • 6,931
  • 7
  • 35
  • 51
  • That's interesting and good but you should always keep in mind the memory that would be used by the picker. – Andrea May 17 '14 at 12:55