gpt4 book ai didi

iphone - 只需按一次“按钮”,即可使用相机捕获多张图像?

转载 作者:行者123 更新时间:2023-12-01 17:33:38 25 4
gpt4 key购买 nike

基本上,通过在相机应用程序中使用自定义叠加层,我希望仅按一次“捕获”按钮即可拍摄多张图像(在我的情况下为5张)。

我了解以下代码:

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

导致拍摄一张图像。按下一个按钮后,是否有办法使此操作重复5次?实际上,这将实现“爆裂”效果,就像在Camera +应用中实现的一样。

最佳答案

尝试使用此代码,它可以从相机拍摄5张照片并存储在阵列中。根据需要使用。

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

}

关于iphone - 只需按一次“按钮”,即可使用相机捕获多张图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11806235/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com