ios - 无法在 swift iOS 中的 UITableViewController 或 UITableViewController 中为 Switch 创建 socket

标签 ios swift xcode

我是 swift 和 Xcode 的新手,我正在尝试一些事情。当我转到设置页面时,我想在设置页面(在应用程序中,而不是在设置 bundle 中)设置开关状态。 (我将segue设置为push) 为此,我尝试为开关创建一个 socket ,并在按下设置页面时将其状态分别更改为保存的值。但是,当我通过 control-darg 切换到 UITableViewController 类时,我可以仅添加一个操作。

我使用的是 Xcode 9.1 和 swift 4

你能告诉我我做错了什么吗? 谢谢。

最佳答案

在你的 Controller 中你需要类似的东西

@IBOutlet var switch: UISwitch!

然后将 UISwitch 拖放到 Storyboard Controller 中您想要切换的位置。

确保 Storyboard Controller 是您声明变量的 Controller 的类。

然后右键单击 Storyboard Controller 中的黄点,然后将开关拖放到 UISwitch。

关于ios - 无法在 swift iOS 中的 UITableViewController 或 UITableViewController 中为 Switch 创建 socket ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47756761/

相关文章:

ios - 卡片扫描功能 iOS

ios - 如何将模型数据对象添加到 Firebase 数据库

ios - Swift:AppDelegate 函数应用程序调用,但接下来会发生什么?

ios - 如何实例化/显示 TableViewController

ios - 升级到 iOS 5.1 和 xcode 4.3,现在应用程序无法安装

ios - 完成处理程序调用两次(带线程)

iphone - 使用 Objective C 监控有关 iPhone 运行进程的信息

swift - 如何在Combine中实现正确的switchMap运算符?

Xcode 5 - 显示编辑过的文件?

c# - 如何在 Monotouch 中绑定(bind)扩展方法?