Perform Segue Programmatically Without Button Connection?

Josh Kahane picture Josh Kahane · Jul 25, 2012 · Viewed 25.4k times · Source

I have two view controllers in my storyboard and I need to push from view 1 to view 2.

I need to do this without connecting a segue directly from a button in my storyboard, I need to do it programatically.

How can I?

Thanks.

Answer

StuStirling picture StuStirling · Jul 25, 2012

When you click the button call:

[self performSegueWithIdentifier:@"SegueIdentifier" sender:self];

You will need to create the segue in the storyboard but you can do it from view controller to view controller instead of button to viewcontroller.