iPad: Iterate over every cell in a UITableView?

后端 未结 7 1880
眼角桃花
眼角桃花 2020-12-08 19:37

iPad: Iterate over every cell in a UITableView?

7条回答
  •  时光说笑
    2020-12-08 20:12

    Swift 4:

    for section in 0...self.tableView.numberOfSections - 1 {
                for row in 0...self.tableView.numberOfRows(inSection: section) - 1 {
                    let cell = self.tableView.cellForRow(at: NSIndexPath(row: row, section: section) as IndexPath)
    
                    print("Section: \(section)  Row: \(row)")
    
                }
            }
    

    by steve Iterate over all the UITableCells given a section id

提交回复
热议问题