Question

Je le code suivant:

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

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

[self presentModalViewController:imagePicker animated:YES];

Ma question est: Comment puis-je rejeter la ModalViewController de "SecondViewController"

?
Était-ce utile?

La solution

Vous devez appeler ce qui suit sur imagePicker à partir d'une méthode UIImagePickerControllerDelegate dans secondView.

Par exemple:

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

Autres conseils

La réponse acceptée ne fonctionne plus dans iOS 7. Ci-dessous la méthode qui devrait être utilisée à la place.

Encore une fois, cette méthode doit être appelée sur le UIImagePicker du UIImagePickerControllerDelegate.

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

}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top