ios - 将类从 Storyboard附加到 TableView 时出现问题

标签 ios swift xcode

我正在开发一个具有用户创建部分的应用程序, 我在 Storyboard上的表格 View 中创建了帐户。

如果我当时运行模拟器,我会看到所有的桌面 View ,一切都很好。 但是一旦我附加一个扩展 UITableViewController 的类, 我在模拟器中运行所有内容 屏幕是空的,没有任何字段。 我究竟做错了什么 ? 我需要寻找什么?

如果我空运行它,我会在模拟器中看到一切都很好>

enter image description here

但是一旦我添加了类,我就看不到任何东西,只有空字段>

enter image description here

谢谢

最佳答案

已修复 通过将我的 Tableview 方法修改为:

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        print ("section: ", section)
        if (section == 0) {
            return 4

        } else if (section == 1) {
            return 1

        } else if (section == 2) {
            return 4

        } else if (section == 3) {
            return 2

        } else if (section == 4) {
            return 1

        } else if (section == 5) {
            return 3

        } else if (section == 6) {
            return 1

        } else if (section == 7) {
            return 1

        } else {
            return 0
        }

    }

关于ios - 将类从 Storyboard附加到 TableView 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53083702/

相关文章:

objective-c - objective-c 中的排序数组或映射?

iOS。从位置创建到谷歌地图的网络链接

swift - Xcode 无法将测试目标添加到现有的 swift 项目 - 要测试的目标显示为灰色

ios - 禁用在 iOS 应用程序上的 SVProgressHUD 中不起作用的用户交互

ios - 当我的 slider 拇指在中间时,为什么没有播放音乐音量?

ios - swift 3 错误 : Type 'AVLayerVideoGravity' has no member 'resizeAspectFill'

xcode - Swift - 从场景获取 CCNode

ios - 应用商店上传警告;警告 ITMS-90686 : "The binary you uploaded was invalid."

swift - 如何在按下通知操作时运行 URL?

ios - 具有可选函数实现的 Swift @objc 协议(protocol)会导致构建错误