使用相机捕获多个图像,单个“按钮按下”后? [英] Capture multiple images with camera, after a single 'button press'?

查看:169
本文介绍了使用相机捕获多个图像,单个“按钮按下”后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,通过使用相机应用程序的自定义叠加层,我想要拍摄多个图像(在我的情况下为5),只需按一下捕获按钮。

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.

我理解以下代码:

- (void)takePicture:(id)sender
{
    self.pictureButton.enabled = NO;
    [self.delegate takePicture];
}

会导致拍摄单张图片。有没有办法让这个动作复制5次,单个按钮按下后?有效地,这将实现像在Camera +应用程序中实现的突发类似的效果。

results in a single image being taken. Is there a way to have this action replicated 5 times, after a single button press? Effectively, this would achieve a 'burst' like effect, as is implemented in the Camera+ app.

推荐答案

尝试此代码5张照片从相机和存储在一个数组。

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

}

这篇关于使用相机捕获多个图像,单个“按钮按下”后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆