Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining a "generic" segue in Interface Builder

I understand how to create a segue in XCode 4.2 by right clicking a control, let's say a button, and dragging it to a view controller in the storyboard.

What I would like to do is create a segue that is not tied to a control, and must be invoked programmatically so I can do something like this:

- (void)viewDidLoad
{
    if (condition) 
    {
        [self performSegueWithIdentifier: @"identifier" sender: self];
    }
}

while still defining the "identifier" segue within Interface Builder. Is this possible?

like image 936
Logan Serman Avatar asked Dec 13 '11 05:12

Logan Serman


1 Answers

You can ctrl-drag from the source view controller to the other scene. You can use the view controller object at the bottom of the scene to do this.

Then of course give it the appropriate identifier and then your code above should work fine.

Hope that helps.

like image 199
Firoze Lafeer Avatar answered Oct 14 '22 15:10

Firoze Lafeer