CaldwellYSR
CaldwellYSR

Reputation: 3196

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:

Upvotes: 4

Views: 3749

Answers (2)

Marco
Marco

Reputation: 6692

Check out generic segues, which are tied to the source view controller instead of an IBAction:

https://stackoverflow.com/a/8868096/295130

Upvotes: 3

Dan F
Dan F

Reputation: 17732

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:...];

Upvotes: 8

Related Questions