Capture multiple images with camera, after a single 'button press'?

后端 未结 1 562

Basically, through the use of a custom overlay with the camera app, I am wanting multiple images (in my case 5) to be taken, with only one press of a \'capture\' button.

1条回答
  •  鱼传尺愫
    2021-01-03 17:38

    Try this code it take 5 pictures from camera and store in an array. use as you need.

    int counter;
    NSMutableArray * imageArray;
    
    -(void)takePicture
     {
           counter=0;
           UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
    [imagePicker setDelegate:self];
    [self presentModalViewController:imagePicker animated:YES];
    [imagePicker release];
    }
    
     - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
    {
    UIImage *image= [info objectForKey:UIImagePickerControllerEditedImage];
    
    [imageArray addObject:image];
    counter++;  
    if (counter<5)
    {
        [self dismissModalViewControllerAnimated:NO];
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
        [imagePicker setDelegate:self];
        [self presentModalViewController:imagePicker animated:NO];
        [imagePicker release];
    }
    else
    {
        [self dismissModalViewControllerAnimated:YES];
    }
    
    }
    

    0 讨论(0)
提交回复
热议问题