【发布时间】:2013-01-31 09:49:43
【问题描述】:
大家好,感谢您的阅读。我正在制作一个应用程序,您可以在该应用程序中拍照并从相机胶卷中检索照片并将其显示在视图上。问题是当我尝试使用调出相机胶卷的按钮时,我在标题中收到错误“演示正在进行中”。
如果我注释掉代码 [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
【问题讨论】:
-
是 UIImagePickerController UIViewController 吗?
-
[This][1] 解决方案可能会对您有所帮助。尝试在主线程 [1] 中呈现:stackoverflow.com/questions/25805643/…
-
link的可能重复
-
除了这个帖子快2岁了
标签: ios camera uiimagepickercontroller presentation