UITableView load more when scrolling to bottom

前端 未结 6 450
深忆病人
深忆病人 2020-12-08 00:28

I would like to load more data and create additional cells when the user scrolls to the bottom of the table. I\'m using JSON data and MySql.

func dataJsonFro         


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 01:01

    You need one very handy delegate method:

    func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell , forRowAtIndexPath indexPath: NSIndexPath) {
    
    }
    

    This method gives your the current displayed row. Use the indexPath it provides to determine when you are nearing the bottom of the table. Then get more JSON and reload the table.

提交回复
热议问题