Swift tableView Pagination

后端 未结 14 1408
长情又很酷
长情又很酷 2020-11-28 20:00

I have success working tableview with json parsing codes.But may have 1000 more item so need pagination when scrolling bottom side. I dont know how can i do this my codes un

14条回答
  •  醉酒成梦
    2020-11-28 20:52

    By using UITableViewDelegate, u can call the function

       func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        let lastItem = self.mes.count - 1
        if indexPath.row == lastItem {
            print("IndexRow\(indexPath.row)")
            if currentPage < totalPage {
                currentPage += 1
               //Get data from Server
            }
        }
    }
    

提交回复
热议问题