问题描述
我正在开发我的第一个具有多个视图屏幕的应用程序,并且在第一个视图上一切正常,我添加了几个文本字段,并且能够将它们作为 Outlets 连接到控制器并从中获取值,对其进行管理并将其吐回标签.
I'm working on my first app with multiple view screens and everything worked great on the first view, I added a couple text fields and was able to connect them to the controller as Outlets and obtain the value from them, manage it and spit it back out to a label.
我尝试将第二个视图上的文本字段控制拖动到 secondControllerView,这样做时唯一可用的是 Action,没有插座,因此它是一个函数而不是变量,我也无法将标签连接到代码根本没有!
I tried control-dragging the text fields on the second view to the secondControllerView and the only thing available when I do so is Action, no outlet, so its a function not a variable and I also cannot connect the labels to the code at all!
有人知道为什么吗?
推荐答案
确保在身份检查器中您为要连接插座的 UIViewController
选择了类.
Make sure in the identity inspector you selected the class for the UIViewController
you are connecting your outlets to.
这篇关于文本字段创建动作而不是出口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!