iOS和xcode:如何为segue提供"storyboard id"这样我就可以以编程方式对其进行操作 [英] iOS and xcode: how to give a segue a "storyboard id" so that I can programmatically manipulate it

查看:122
本文介绍了iOS和xcode:如何为segue提供"storyboard id"这样我就可以以编程方式对其进行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个从视图控制器到新视图的模态segue,但不希望将segue动作链接到按钮或其他任何东西.相反,我只想设置segue,以便可以在pageDidLoad中调用它,并根据需要自动执行它.

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. 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,例如:

To do this, I need to be able to reference the segue, such as this:

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

在故事板中按住Control键并单击并拖动以创建序列后,如何命名该名称以供以后参考?谢谢!

After I control-click-drag a connection in storyboard to create a segue, how can I give it a name for later reference? Thanks!

推荐答案

将segue动作从当前的viewController链接到新的视图控制器.我认为这是您想要的,请参见屏幕截图.

Link the segue action from curent viewController to new view controller. I think this you want, see the screenshot.

链接将帮助您获取剩余的代码.

This link will help you for remaining code.

这篇关于iOS和xcode:如何为segue提供"storyboard id"这样我就可以以编程方式对其进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆