在单次“按下按钮"后,用相机拍摄多张图像? [英] Capture multiple images with camera, after a single 'button press'?
本文介绍了在单次“按下按钮"后,用相机拍摄多张图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
基本上,通过在相机应用中使用自定义叠加层,我希望只需按一次捕获"按钮即可拍摄多张图像(在我的情况下为 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屋!
查看全文