1. 程式人生 > >Simpler ways of creating and using Segue in Xcode

Simpler ways of creating and using Segue in Xcode

  • To create and use segue, first of all, we will require two view controllers. And I have created two of them namely ViewController and SecondViewController and both are there in storyboard as well.
  • Let's say in our first view controller we add a button from object directory by dragging and dropping uibutton in the viewcontroller, this button will take us from ViewController
    to SecondViewController.
  • In order to that we need to setup a segue and setting up a segue is very easy. All you need to do is just click the button, hold down the control key on keyboard and click and drag and point to the SecondViewController.
  • You will see a popup of types of segue, chose Show from the options. It can be changed at the point of development time if needed later on.
  • As soon as you chose Show from the option, you will see that Xcode has drawn a line from ViewController to SecondViewController
  • And that's all. If you run your app now click on the button it will take you to the SecondViewController