How do I create a segue that can be called from a button that is created programmatically?

Here is how to set up a segue so that it can be called programmatically.

  • Control drag from the ViewController icon in the first view controller to the second view controller.
  • Click on the segue arrow between the two view controllers, and in the Attributes Inspector on the right, give the segue an Identifier (tableau in your case).
  • Then you can trigger the segue with performSegueWithIdentifier in your code.

enter image description here

You can read more about setting up and using segues here.

Leave a Comment