我有以下代码:
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setCameraOverlayView:secondView.view];
[imagePicker setShowsCameraControls:NO];
[self presentModalViewController:imagePicker animated:YES];
我的问题是:如何从“SecondViewController”中解除ModalViewController?
答案 0 :(得分:10)
您必须通过imagePicker
中的UIImagePickerControllerDelegate
方法在secondView
上拨打以下电话。
例如:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// process message
[imagePicker dismissModalViewControllerAnimated:YES];
}
答案 1 :(得分:1)
接受的答案在iOS7中不再有效。以下是应该使用的方法。
同样,应该从UIImagePicker
的{{1}}调用此方法。
UIImagePickerControllerDelegate