ios - 从情节提要将类附加到 tableview 时出现问题
问题描述
我正在开发一个具有用户创建部分的应用程序,我在情节提要的表格视图中创建了创建帐户。
如果我当时只是运行模拟器,我会看到所有的 tableview,一切都很好。但是一旦我将一个扩展 UITableViewController 的类附加到它,并且我在模拟器中运行所有内容,屏幕就是空的,没有字段。我究竟做错了什么 ?我需要寻找什么?
如果我空运行它,我会在模拟器中看到一切都很好>
但是一旦我添加了课程,我什么都看不到,但是空字段>
谢谢
解决方案
通过修改我的 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
}
}
推荐阅读
- android - 我的设备未显示“允许 USB 调试”对话框
- java - 将 spring j_spring_security_check 迁移到登录
- angular - 防止 Angular 递归加载组件
- sql - Oracle sql dev,显示超过 10 个用户的作业,分组功能
- javascript - 有没有 ?(“安全运算符”)在 Typescript 中处理空值的替代方法?
- excel - 用于将选定数据复制到新工作簿的 VBA
- python - 在python中以管理员身份运行批处理文件
- pyspark - 应用模型后Pyspark提取转换数据帧的概率
- python - 如何从列表和元组中提取
- python - python导入如何工作以及它如何在Windows中加载所需的DLL