简体   繁体   English

iOS和xcode:如何给segue一个“故事板id”,以便我可以以编程方式操作它

[英]iOS and xcode: how to give a segue a “storyboard id” so that I can programmatically manipulate it

I am wanting to create a modal segue from a view controller to an a new view, but not by linking the segue action to a button or anything. 我想要从视图控制器创建一个模态segue到一个新视图,但不是通过将segue动作链接到按钮或任何东西。 Instead, I'd like to just set the segue up so that I can call it in pageDidLoad and have it automatically execute if I want. 相反,我想设置segue,以便我可以在pageDidLoad中调用它并让它自动执行,如果我想要的话。

To do this, I need to be able to reference the segue, such as this: 为此,我需要能够引用segue,例如:

[self performSegueWithIdentifier:@"mySegue" sender: ...];

After I control-click-drag a connection in storyboard to create a segue, how can I give it a name for later reference? 在我控制 - 单击 - 拖动故事板中的连接以创建segue后,如何为其命名以供以后参考? Thanks! 谢谢!

Link the segue action from curent viewController to new view controller. 将segue动作从curent viewController链接到新的视图控制器。 I think this you want, see the screenshot. 我想你想要的,请看截图。

在此输入图像描述

This link will help you for remaining code. 链接将帮助您保留代码。

Nevermind! 没关系! In the details pane sidebar of xcode, under the third tab there is an "Identifier" field that can be filled out! 在xcode的详细信息窗格侧边栏中,在第三个选项卡下面有一个“标识符”字段,可以填写!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM