Getting visible cell from UITableView pagingEnabled

前端 未结 5 1905
孤城傲影
孤城傲影 2020-12-13 15:35

I have a UITableView with pagingEnabled. Each cell takes up the viewing area of the table. Meaning, each cell is the same height and width as the table. I\'m using custom

5条回答
  •  余生分开走
    2020-12-13 16:03

    Swift 4+

        
        func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
            let firstVisibleIndexPath = self.tableView.indexPathsForVisibleRows?[0]
            
            print("top visible cell section  is \([firstVisibleIndexPath!.section])")
        }
    

提交回复
热议问题