问题描述
我想将一个segue从我的viewcontroller拖到自己身上。所以我可以推送那个特定视图控制器的无限实例。
I want to drag a segue from my viewcontroller, to itself. So I can push "infinite" instances of that particular view controller.
我知道如何在代码中执行此操作(例如,以编程方式实现视图控制器)。但是,我想尽可能使用segues。
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.
我发现了一些hacks让故事板中的segue成为自我,但我不喜欢黑客,所以我的问题是;
I've found a few "hacks" for making segue to self in storyboard, but I don't like hacks, so my question is;
有没有一种干净的方法让故事板中的自我回归?我不想从按钮等拖动它,我只想要一个我可以使用的通用segue:
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"]
谢谢。
推荐答案
您可以在故事板本身中执行此操作。从对象库中拖出Storyboard引用,然后控制从视图控制器拖动到storyboard引用以创建segue,并选择转换类型。然后选择故事板参考,确保检查器中的属性设置为相同的故事板文件,并且它的故事板ID引用了相同的视图控制器。
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.
这篇关于在故事板中将Segue拖到自我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!