use*_*182 -2 arrays uitableview ios swift
我正在尝试对 TableView 的行进行编号,以便每个单元格使用 Swift 显示其编号。
例如:第一个单元格显示 1,第二个单元格显示 2,依此类推...

你可以试试这个。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
cell.someLabel.text = "\(indexPath.row + 1)." //You have to + 1 ,because cells are zero based.
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5899 次 |
| 最近记录: |