How to create a segue in iOS without having an ass

2020-03-26 05:02发布

问题:

I load "ViewController1" first. It does a bunch of background housekeeping work and then goes to "ViewController2".

To perform a Segue to "ViewController2", the only way I know is to add a BUTTON (which user never needs to see or use) and then add a segue from that button to the "ViewController2" by holding down control and dragging.

My question is -- Since I dont really need the button in ViewController1 here, how can I just create a Segue and then do it in code using performSegueWithIdentifier("segue_LoginToStart", sender: nil)

回答1:

Step -1

-- select your stoyboard name (Yellow button) in Storyboard

Step -2

-- Press Ctrl + right click -- segue to your destination view controller

Step -3

-- give the seque name in attribute

Step -4

call the following line where you want

 performSegueWithIdentifier("segue_LoginToStart", sender: nil)


回答2:

Right click "Yellow button". (I don't know the name of this button)