How to create a segue in iOS without having an ass

2020-03-26 04:20发布

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)

How to perform Segue without having an associated UI Element like a Button?

2条回答
▲ chillily
2楼-- · 2020-03-26 05:11

Step -1

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

Step -2

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

enter image description here

Step -3

-- give the seque name in attribute

Step -4

call the following line where you want

 performSegueWithIdentifier("segue_LoginToStart", sender: nil)
查看更多
Emotional °昔
3楼-- · 2020-03-26 05:12

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

enter image description here

查看更多
登录 后发表回答