0

i am using a segue for transition between two view controllers i have some different-different conditions according to which i want to change segue identifier. i have only one button with one segue, in first ViewController.

well.... seeing the problem, its obvious i can't do it statically when i am designing UI in attribute inspector under Storyboard. so can i do it programmatically, at the runtime???

Is there any possible way to come over this problem. A code would be really helpful.

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
  • If you only have one button with one segue, why do you need multiple identifiers? I can't see any reason to do this. – rdelmar Jun 08 '13 at 14:57
  • My completely storyboard-less application uses segues, and I believe the answer may be provided by me at http://stackoverflow.com/questions/22961383/set-segue-identifier-programmatically/41206355#41206355. – James Bush Dec 18 '16 at 21:04

1 Answers1

1

The iOS way to do this would be to have multiple segues in your storyboard, each with unique identifiers and possibly going to different UIViewControllers. That way you can determine which one to fire off in your code (using performSegueWithIdentifier:).

You are not meant to modify a segue outside of a storyboard. See Creating a segue programmatically for more details.

Community
  • 1
  • 1
Dylan Kirkby
  • 1,427
  • 11
  • 19