我使用un UINavigationCtronller从UIViewController导航到一个UIViewController B. 在UIViewController B的视图中,我点击一个按钮并调用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
如果我点击任何地方,应用程序崩溃了。
欢迎任何评论
答案 0 :(得分:3)
而不是
[picker dismissModalViewControllerAnimated:YES];
试
[picker.presentingViewController dismissModalViewControllerAnimated:YES];
您希望呈现选择器的ViewController被解雇,而不是选择器本身。