0

This worked in iOS6, so not sure what the issue is.

inside my UINavigationController (ioNavController) I present the UIImagePickerController with the Following:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.modalInPopover = YES;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:imagePicker animated:NO  completion:^{  }]; 

in my UIImagePickerControllerDelegate (which does get called)I have the Following:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

    //This does not work
    [ioNavController dismissViewControllerAnimated:YES completion:^{ /* Cleanup if Needed */ }];

    //This does not work
    [[picker parentViewController] dismissViewControllerAnimated:YES completion:^{ /* Cleanup if Needed */ }];

    //This does not work
    [picker removeFromParentViewController];

    // This presents a new view on the Nav Controller. It shows the new view ontop of the ImagePicker. Image Picker View does not repond to touches. 
    [ioNavController pageToSelect:0];

}
scooter133
  • 1,297
  • 1
  • 15
  • 29
  • Have you logged ioNavController to see if it's nil? Also, when you present a view controller, you should access the one that presented it with self.presentingViewController, not parentViewController. – rdelmar Aug 04 '13 at 00:54
  • have you tried anything? Please, give some feedback – Lucas Eduardo Aug 05 '13 at 02:28

2 Answers2

0

Your delegate it's in the same controller that called the imagepicker? The same controller that called presentViewController should call the line below, and the imagepicker will be removed correctly.

[self dismissViewControllerAnimated:YES completion:nil]; //self here it's the same reference that called presentViewController

let me know if worked or helped.

Lucas Eduardo
  • 11,525
  • 5
  • 44
  • 49
0

The UIImagePickerController will remove itself when you use this code:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)pPicker {
[pPicker dismissViewControllerAnimated:YES completition:NULL]; }
LaborEtArs
  • 1,938
  • 23
  • 27