0

I added this code to perform a segue:

UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"groupselection"];
    [self.navigationController pushViewController:controller animated:YES];

I then gave the viewcontroller in the storyboard this id: groupselection

But the segue is not performed!! Any ideas?

2 Answers 2

3

yes, you do not push view controllers in storyboards so don't use PushViewController.

You use

[self performSegueWithIdentifier:@"Identifier you gave your segue"];

then you wire up the segue inside the storyboard by control dragging. Make sure you drag from the existing controller (the yellow circle below the controller with square inside it) to the new one, and then selecting what kind of segue you want (push, modal, replace)

enter image description here

then you will see a wire connecting the two controllers. Click on the middle circle, when the story is zoomed in all the way. In identity inspector on the right, give this seugue an identifier. That's the name you will use in your code.

0
0

Technically, this is not a segue, but rather just pushing a new controller onto your navigation stack. If you are using storyboards just create a real segue. You will have to post more code for us to trouble-shoot this. When are you pushing this view controller? Is your storyboard view controller with that ID subclassed?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.