【发布时间】:2019-03-10 16:09:14
【问题描述】:
我想将原型单元格中的标签文本设置为存储在数组中的字符串。
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "unitOptionCell", for: indexPath)
cell.textLabel?.text = currentConvertion.availableUnits(indexPath)
return cell
}
数组如下:
var availableUnits: [String] {
switch category {
case .firstCategory:
return ["test 1", "test 2", "test 3"]
case .secondCategory:
return ["test 4", "test 5", "test 6"]
case .thirdCategory:
return ["test 7", "test 8", "test 9"]
}
}
哪里出错了?
【问题讨论】:
标签: arrays swift string uitableview cell