【发布时间】:2016-11-26 00:32:20
【问题描述】:
我有一本字典并从我的数据库中导入信息。我需要把它专门放在我的表格视图的正确部分。提供了所有信息,如果您需要更多详细信息或代码,我会提供。
字典输出["March 27": ["do the dishes", "take out the trash"], "March 29": ["Walk the dog", "Water the plants"], "March 28": ["Clean the house"]]
var date = ["March 27", "March 28", "March 29"]
func numberOfSections(in tableView: UITableView) -> Int {
return date.count
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return date[section]
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = table.dequeueReusableCell(withIdentifier: "cell") as! Chores
//Having trouble on what to do here
return cell
}
【问题讨论】:
标签: ios swift uitableview dictionary