Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you call other segues from other view controllers?

Tags:

ios

segue

So I have a delegate set up in one class which can potentially enter a segue. If I call this function from another view controller, will the segue be performed? Or can only view controllers directly connected to segues perform a segue?

like image 404
Tassos S Avatar asked Aug 25 '13 04:08

Tassos S


1 Answers

The segue is defined from one view controller to another, so you have to invoke from the view controller in which it is defined. A workaround is to simply push the view controller without using segues. You can instantiate your view controller, assuming you've given it a storyboard id.

UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"DestinationController"];

Then, you push the view controller.

[self.navigationController pushViewController:controller animated:YES];
like image 156
Erik Godard Avatar answered Nov 11 '22 16:11

Erik Godard