Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag Segue To Self in Storyboard

I want to drag a segue from my viewcontroller, to itself. So I can push "infinite" instances of that particular view controller.

I know how to do this in code (I.e instansiate the view controller programmatically). However, I want to use segues as far as possible.

I've found a few "hacks" for making segue to self in storyboard, but I don't like hacks, so my question is;

Is there a clean way to make a segue back to self in the Storyboard? I dont want to drag it from a button or such, I just want a generic segue that i can use with:

[self performSegueWithIdentifier:@"segueIdentifier"]

Thanks.

like image 738
ullstrm Avatar asked Feb 21 '14 14:02

ullstrm


1 Answers

You can do this in the storyboard itself. Drag a Storyboard Reference from the Object Library, and then control drag from your view controller to the storyboard reference to create a segue, and select the type of transition. Then with the storyboard reference selected, make sure it's attributes in the inspector are set to the same storyboard file, and the same view controller referenced by it's storyboard ID.

like image 180
aleksey Avatar answered Sep 25 '22 01:09

aleksey