1

How do you make a programmatic segue? I tried this:

[self performSegueWithIdentifier:@"next" sender:self]; 

but it only gives me this console message:

Snapshotting a view that has not been rendered results in an empty snapshot. 
Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

What I want to do is Have a button which triggers a image picker to appear. When the user has selected an image, a segue to the next view controller is performed.

user5227744
  • 127
  • 5
  • You connected the Segue from one ViewController to another in the StoryBoard file? You are waiting for the Picker to finish the execution block and THEN calling the Segue? – David Cruz Aug 30 '15 at 15:27
  • Yes. I am calling the method in the "didFinishPickingMediaWithInfo" method. – user5227744 Aug 30 '15 at 15:29

2 Answers2

0

I don't have enough reputation to add a comment but if you are attempting to present UIImagePickerController I would advice you to read this post

Community
  • 1
  • 1
  • [self presentViewController:viewController3 animated:YES completion:nil]; But it doesn't work. It just gives me a black screen. – user5227744 Aug 30 '15 at 15:37
0

You could prepare the segue before showing it (Supposing you already connected the segue in the Storyboard and named it)(You wait for the execution block of the picker to complete before performing the Segue).

 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
     // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"next"]) {

        NextViewController *vc = [segue destinationViewController];
        // Call anything from the vc

    } 
  }

Hope you get some clues.

David Cruz
  • 2,995
  • 3
  • 28
  • 41