大家好,感谢您的阅读。我正在制作一个应用程序,您可以在该应用程序中拍照并从相机胶卷中检索照片并将其显示在视图上。问题是当我尝试使用调出相机胶卷的按钮时,我在标题中收到错误“演示正在进行中”。
如果我注释掉代码 [self presentViewController:imagePicker animated:YES completion:NULL]; 在 viewdidappear 方法中,我可以调出相机胶卷......我不知道如何正确关闭它,我试过 [imagePicker dismissViewControllerAnimated:YES completion:NULL]; 但无济于事。
这是我的代码!感谢检查出来。
-(IBAction)chooseExisting:(id)sender {
[imagePicker dismissViewControllerAnimated:YES completion:NULL];
imagePicker2 = [[UIImagePickerController alloc] init];
imagePicker2.delegate = self;
[imagePicker2 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:imagePicker2 animated:YES completion:NULL];
}
-(void)viewDidAppear:(BOOL)animated{
while (chooseExistingInt <1) {
overlayView.hidden = false;
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:imagePicker animated:YES completion:NULL];
imagePicker.showsCameraControls = NO;
imagePicker.cameraOverlayView = overlayView;
chooseExistingInt ++;
}
}
固定(也许)我改变了:
[imagePicker dismissViewControllerAnimated:YES completion:NULL];
至
[imagePicker dismissViewControllerAnimated:NO completion:NULL];
将动画更改为“否”。跆拳道:s