UITableView load more when scrolling to bottom

前端 未结 6 463
深忆病人
深忆病人 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条回答
  •  旧时难觅i
    2020-12-08 01:13

    Xcode 8, Swift 3

    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        let lastElement = dataSource.count - 1
        if !loadingData && indexPath.row == lastElement {
            indicator.startAnimating()
            loadingData = true
            loadMoreData()
        }
    }
    

提交回复
热议问题