【发布时间】:2021-01-15 04:19:29
【问题描述】:
所以我根据用户输入创建了这个数量的部分。 例如我输入了 2 个部分,我填充了 1 - 8 个数字,它工作得很好:
但是当我输入了 4 个部分并填充了 1 - 16 个数字时,但是查看第 1 部分,值改变了我不知道为什么。图片如下:
这是我的功能代码:
func getAllValue() {
for sectionIndex in 0...finalSectionNumber - 1 {
print("section index: \(sectionIndex)")
print("final txt field: \(finalSectionNumber)")
for rowIndex in 0...tableView.numberOfRows(inSection: sectionIndex) - 1 {
let indexPath = IndexPath(row: rowIndex, section: sectionIndex)
let cells = tableView.cellForRow(at: indexPath) as? CellOutlet
print("row index: \(rowIndex)")
print(cells?.txtFieldSpecNumb.text ?? 0)
}
}
}
我在这里错过了什么? 有人可以帮忙吗?
提前谢谢你
【问题讨论】:
标签: ios swift uitableview tableview cell