Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storyboards multiple buttons cause same segue

I'm working on trying to figure out storyboards and it all seems pretty cool but I'm having problems with moving from one screen with a few buttons to another screen no matter which button is pressed. Obviously I can control drag from each button but then I have segues all over the place on the story board and I feel like there has to be a better way to do it. I've tried highlighting all the buttons and control-dragging to the next screen but that only caused the one I dragged from to work.

Here's an illustration of what I have that works right now...

This works but it's hideous!!!

If I have to stick with this then so be it but I'm going to end up with 6 buttons on one page and 8 on another. That's alot of segues. Basically each button signifies a choice for the user. That choice will cause different things to happen behind the scenes but no matter which button they choose they move to the next screen.

What I've Tried:

  • Highlighting all the buttons and then dragging to the next view controller.
    • This failed because it only connected the segue to the button I clicked on when I control-dragged
  • Dragging out one segue then dragging from the second button to the circle part of the segue.
    • This caused nothing at all to happen.
like image 453
CaldwellYSR Avatar asked Dec 21 '22 18:12

CaldwellYSR


1 Answers

I'm unaware of a way to give a single segue multiple triggers in a storyboard, however you could create a single segue with a particular identifier, and then have all of the buttons respond to a single IBAction that calls [self performSegueWithIdentifier:...];

like image 139
Dan F Avatar answered Jan 10 '23 02:01

Dan F