David
David

Reputation: 583

Programmatically take X amount of pictures

I am trying to implement a feature of taking X amount of pictures programmatically after entering a UIViewController for both the iPhone and iPad. I looked into UIImagePickerController but I do not want to present the camera controls and have the user hit a button to capture only one photo. Is there a way to capture X amount of photos once entering a UIViewController and storing all the photos in the end for future reference in one go?

Edit:

-(void)viewDidAppear:(BOOL)animated
{
    // Create image picker controller
    picker = [[UIImagePickerController alloc] init];

    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        [picker setSourceType:UIImagePickerControllerSourceTypeCamera];
    }
    else
    {
        [picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    }

    // Set source to the camera
    picker.sourceType =  UIImagePickerControllerSourceTypeCamera;

    // Delegate is self
    picker.delegate = self;

    // Allow editing of image ?
    picker.allowsEditing = NO;

    //picker.showsCameraControls = NO;

    // Show image picker
    [picker animated:YES completion:nil];
}

Upvotes: 0

Views: 580

Answers (2)

Dipen Panchasara
Dipen Panchasara

Reputation: 13600

straight away with takePicture you can not take multiple snaps, for that you have to use some video recording and get snap out of it for particular frame or time, for you more reference you can use this apple documentation for bulk snaps AVFoundation Programming Guide

Upvotes: 1

WrightsCS
WrightsCS

Reputation: 50727

You can try something like this:

int numberOfPhotos = 3; // Number of photos you want to take.
for ( int i = 0; i < numberOhPhotos; i++ )
{
    // Note that you should use some sort of a pause in between each photo.
    [picker takePicture];
}

Upvotes: 1

Related Questions