Luke
Luke

Reputation: 9690

Create a storyboard segue that isn't attached to any UI element?

I'm trying to trigger a storyboard segue from a UI element which isn't in my storyboard (in this case, it's a UIAlertView). As such, I can't draw the arrow from any of the existing components in my storyboard.

What's the proper way to deal with this situation? I need a segue with an identifier, so that I can call it from the relevant UIAlertView button.

Upvotes: 2

Views: 946

Answers (1)

Alladinian
Alladinian

Reputation: 35616

You can add your segue by right click + drag from your source controller to your destination controller in your Storyboard. Then just click on the created segue and set the identifier. You can trigger your segue programmatically like this:

// Note: In this example self is the source controller
// (the controller that holds the segue)
[self performSegueWithIdentifier:@"mySegue" sender:self];

Here is a screenshot you can use as a reference:

enter image description here

Upvotes: 7

Related Questions