简体   繁体   中英

How programmatically push segue in Storyboard?

在此处输入图片说明

How to push view controller programmatically? In some case not button press but programmatic trigger needs. How?

Need write something like:

[self performSegueWithIdentifier:@"menu41" sender:self];

or

[self.self.navigationController performSegueWithIdentifier:@"menu41" sender:self];

Added an identifier "menu41" to segue.

You can try this: use this code to perform segue:

self.performSegueWithIdentifier("menu41", sender: self)

This will call method where you can pass values or perform any specific activity as per requirement.

override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) { if segue.identifier == "menu41" {

}

You should use [self performSegueWithIdentifier:@"menu41" sender:self]; See the Discussion section on Apple Dev forum

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM