0
我正在做一个教程,现在正在构建一个单元格表格,我有一个问题。在第二个函数tableView下面...什么是indexPath?UITableView - 什么是indexPath?
更重要的是,每次函数被调用时,程序如何知道更新通过indexPath传递的值?
var rowNumber = 0
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 50
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let rowCell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell")
rowCell.textLabel?.text = String(indexPath.row + 1)
return rowCell
}
您是否阅读过“UITableView”的参考文档?它有一个关于什么'IndexPath'('NSIndexPath')的部分。另请参阅“IndexPath”的文档。 – rmaddy
是的,我已阅读文档,否则我不会问。不过谢谢。 – user7024499