我使用 un UINavigationCtronller 从 UIViewController A 导航到 UIViewController B。
在 UIViewController B 的 View 中,我点击一个按钮并调用 UIImagePicker
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
ipc.delegate = self;
ipc.allowsEditing = NO;
[self presentModalViewController:ipc animated:YES];
如果我点击 UIImagePicker 的“取消”按钮,我会打电话
-(void)imagePickerControllerDidCancel:(UIImagePickerController*)picker{
[picker dismissModalViewControllerAnimated:YES];
}
UI 将返回 UIViewController A 而不是 B
如果我点击任何地方,应用程序就会崩溃。
欢迎任何评论
最佳答案
代替
[picker dismissModalViewControllerAnimated:YES];
尝试
[picker.presentingViewController dismissModalViewControllerAnimated:YES];
您希望显示选择器的 ViewController 被关闭,而不是选择器本身。
关于ios - 关闭图像选择器导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9871179/