["06:58"]
["07:13", "07:38", "07:53"]
["08:13", "08:38", "08:53"]
["09:13", "09:33", "09:53"]
,我想在tableView
顯示它在圖片:
每一個元素 - 這是UILabel
,我創建class TimeViewCell: UITableViewCell
哪裏有屬性var labels = [UILabel]()
,但我不知道如何從我的函數中推送數據:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellTime", for: indexPath) as! TimeViewCell
let showHour = self.infoWripper.sorted(by: { $0.hour < $1.hour })
cell.labelTime.text = showHour[indexPath.row].showHour()
for data in showHour {
print(data.showFullTime()) //here you see my example of data in console
}
return cell
}
我建議你在uitableviewcell裏面創建collectionView,除非你有特定的最大可能次數。 – Miknash
你有最多的細胞項目? – Larme
@Larme不,我不知道最大的項目可能是什麼(可能是15,但對於每個細胞的計數可能會改變) –