UIImagePickerController rejection

I have the following code:

SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];

[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setCameraOverlayView:secondView.view];
[imagePicker setShowsCameraControls:NO];

[self presentModalViewController:imagePicker animated:YES];

      

My question is, how can I dismiss the ModalViewController from the "SecondViewController"?

+2


source to share


2 answers


You have to call the following in imagePicker

from method UIImagePickerControllerDelegate

in secondView

.

For example:



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

      

+10


source


The accepted answer no longer works in iOS7. Below is the method to use instead.

Again, this method should be called UIImagePicker

from UIImagePickerControllerDelegate

.



-(void) imagePickerController:(UIImagePickerController *)picker
             didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [[picker presentingViewController] dismissViewControllerAnimated:YES completion:NULL];

}

      

+1


source







All Articles