以编程方式设置segue标识符 [英] Set segue identifier programmatically

查看:120
本文介绍了以编程方式设置segue标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个带有textField和按钮的ViewController。



我想使用展开segue,这样我就可以将textField的信息传递给我的其他人单击按钮后的viewController。



我想使用PrepareForSegue方法,这样我就可以在imunwiding之前将textField中的文本保存到属性中。 / p>

如何手动为我的segue设置一个标识符?如果它是一个条形按钮项目我可以使用IB设置标识符(例如保存)和然后使用它。不是这种情况,只是常规按钮。

解决方案

无法以编程方式创建segues。没有故事板就不能存在。



请参阅此问题


Lets say i have a ViewController with a textField and a button.

I want to use an unwind segue so i could get the information of the textField to my other viewController after i clicked the button.

I want to use the PrepareForSegue method so i could save the text from the textField in a property before i"m "unwiding".

How do i set an identifier to my segue manually? If it was a bar Button item i could use the IB to set the identifier ( to "Save" for example) and then use it. This is not the case, just a regular button.

解决方案

It is not possible to create segues programmatically. They cannot exist without storyboards.

See this question.

这篇关于以编程方式设置segue标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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