我正在从iOS应用程序的上下文发送中加载可接口的值。数据传递是成功的但是tableview方法
rowController(at: index)
返回nil值和numberOfRows变量在代码行之后仍为0
tableView.setNumberOfRows(3, withRowType: "deviceRow")
我的整体代码是
func setupTable() {
tableView.setNumberOfRows(devicesArray.count, withRowType: "deviceRow2")
for (index, device) in self.devicesArray.enumerated() {
if let row = tableView.rowController(at: index) as? MeasurementCell {
row.deviceNameLabel.setText(device)
row.readingLabel.setText(self.readingsArray[index])
let statusColor = colorWithHexString(hex: self.colorsArray[index])
// row.backgroundGroupView.setBackgroundColor(statusColor.withAlphaComponent(0.2))
row.readingLabel.setTextColor(statusColor)
row.dateLabel.setText(self.datesArray[index])
row.readingLabel.setTextColor(self.getColor(fromString: self.colorsArray[index]))
row.readingLabel.sizeToFitWidth()
}
}
该问题有解决方法吗?建议非常感谢。