Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically enumerate outgoing Segues for a UIViewController

For iOS 5 navigation between view controllers, the UIViewController Class provides [self performSegueWithIdentifier:@"MySegue" sender:sender] selector. Presumably, under the hood, the storyboard implementation knows the list of segue identifiers outgoing from any view controller, i.e. [@"MySegue", @"MySegue2"]. Is there any way to access this list programmatically, to get the identifiers that can be passed to performSegueWithIdentifier?

like image 548
btown Avatar asked Feb 09 '12 06:02

btown


1 Answers

This is an undocumented behaviour but

NSArray *segueTemplates = [self valueForKey:@"storyboardSegueTemplates"] ;  

should return an array that includes all possible segue values that can be passed to performSegueWithIdentifier.

like image 65
Rog Avatar answered Sep 27 '22 19:09

Rog