我只想输入部分的第一行。如何实现这一目标?
我还无法做到这一点,但就编程而言,这对我来说是最有意义的。
if indexPath.section == 1 {
let text = tableView.cellForRow(at:0)
text.categoryLabel.text! = "text goes here"
}
最佳答案
您应该首先将文本添加到用于加载 tableView 的数组中:
//Add text input into Array
self.array.insert("The Text Message", at: 0)
self.tableView.beginUpdates()
//Insert into TableView
self.tableView.insertRows(at: [IndexPath.init(row: 0, section: 0)], with: .automatic)
self.tableView.endUpdates()
请告诉我这是否对您有帮助。
关于swift - 将数据输入到特定部分行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55509605/