views:

266

answers:

1

Hi

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 "SecondViewController"?

+2  A: 

You must call the following on imagePicker from a UIImagePickerControllerDelegate method in secondView.

For example:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    // process message
    [imagePicker dismissModalViewControllerAnimated:YES];
}
Nick Bedford
almost; secondView.view is the overlay, not the delegate, You would need to set the image picker's delegate to secondView as well.
Ed Marty