Simpler ways of creating and using Segue in Xcode
阿新 • • 發佈:2018-12-28
- To create and use segue, first of all, we will require two view controllers. And I have created two of them namely
ViewController
andSecondViewController
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
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
toSecondViewController
- And that's all. If you run your app now click on the button it will take you to the
SecondViewController