【发布时间】:2021-06-24 13:08:00
【问题描述】:
我已从 API 获取此数据 - 这是接下来 7 天的天气报告。我想将其显示为表格视图,其中
- 日期将作为部分
- 温度(最小值/最大值)作为行
但是如果我选择这样的部分编号 -
func numberOfSections(in tableView: UITableView) -> Int {
return myList.count // myList is an array of containing the 7 day's data
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
它在所有部分打印同一行(数组的第一个数据)。那么如何在不拆分数组的情况下在单独的部分打印单独的天气?
【问题讨论】:
-
请不要显示代码图片。
标签: ios swift uitableview tableview