解雇UIImagePickerController

时间:2009-10-08 23:59:47

标签: iphone uiimagepickercontroller iphone-sdk-3.1

我有以下代码:

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?

2 个答案:

答案 0 :(得分:10)

您必须通过imagePicker中的UIImagePickerControllerDelegate方法在secondView上拨打以下电话。

例如:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    // process message
    [imagePicker dismissModalViewControllerAnimated:YES];
}

答案 1 :(得分:1)

接受的答案在iOS7中不再有效。以下是应该使用的方法。

同样,应该从UIImagePicker的{​​{1}}调用此方法。

UIImagePickerControllerDelegate