I want to call programmatically a segue from the imagePickerController:didFinishPickingMediaWithInfo: method, but it doesn’t work. It doesn’t crash, but doesn’t work. It just does nothing. The prepareForSegue method is called correctly.
- (void) imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
rutaFoto = [info valueForKey:UIImagePickerControllerMediaURL];
[self dismissModalViewControllerAnimated:YES];
[self performSegueWithIdentifier:@"aGaleria" sender:self];
}
The segue links 2 UIViewControllers.
And if I call the segue with performSegueWithIdentifier from other place (e.g. from a push UIButton method), it works.
Any ideas?
Try using dismissViewControllerAnimated:completion: and put the call to performSegueWithIdentifier:sender: in the completion block (dismissModalViewControllerAnimated: is depreciated anyway, so you shouldn’t be using it).