我正在开发一个应用,实现从相机拍照和从图库选择照片的功能。
对于从图库中选择照片,我使用了ELCImagePickerController库,并将这些图片设置在一个滚动视图中。
现在我想要从相机中拍摄多张照片,并将它们设置在同一个滚动视图中。
目前我的实现方法是:
- (IBAction)takePhoto:(UIButton *)sender {
UIImagePickerController *cameraPicker = [[UIImagePickerController alloc] init];
cameraPicker.delegate = self;
cameraPicker.allowsEditing = YES;
cameraPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:cameraPicker animated:YES completion:NULL];
}
- (void)imagePickerController:(UIImagePickerController *)photoPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[photoPicker dismissViewControllerAnimated:YES completion:NULL];
UIImage *image=[info objectForKey:UIImagePickerControllerEditedImage];
UIImageView *imageview = [[UIImageView alloc] initWithImage:image];
[imageview setContentMode:UIViewContentModeScaleAspectFit];
[self.scrollView addSubview:imageview];
[self dismissModalViewControllerAnimated:YES];
}
我只能一次拍摄一张照片,当我再次拍摄时,它会替换之前的照片。我该如何连续拍摄多张照片?应该怎么做呢?
AssetsLibrary
框架非常容易地实现这一点。 - Fahri Azimov