以编程方式拍摄X张图片

时间:2013-04-22 23:03:07

标签: ios objective-c uiimagepickercontroller

我正在尝试为iPhone和iPad输入UIViewController后以编程方式实现拍摄X张照片的功能。我查看了UIImagePickerController,但我不想展示相机控件,让用户按下按钮只能拍摄一张照片。有没有办法在输入UIViewController后拍摄X张照片,并将所有照片存储在最后以供将来参考?

修改

-(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];
}

2 个答案:

答案 0 :(得分:1)

您可以尝试这样的事情:

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];
}

答案 1 :(得分:1)

直接使用takePicture你不能进行多次快照,因为你必须使用一些视频录制并在特定的帧或时间内快速删除它,为了更多参考,你可以使用这个苹果文档进行批量快照{{ 3}}