devopsinthecloud icon indicating copy to clipboard operation
devopsinthecloud copied to clipboard

Question - How to implement infinite scroll??

Open jaySoftdev opened this issue 5 years ago • 1 comments

Is there any way we can implement infinite scroll for load more data? Let's say user inserts @Joseph as a search, and there are more than 50 Joseph. So I want to implement infinite scroll for load more data when use scrolls the list.

jaySoftdev avatar Dec 19 '19 12:12 jaySoftdev

I was stuck with the same issue. How I achieved this was keeping a reference of tableView in func cell(forMentionsEntity entity: HKWMentionsEntityProtocol!, withMatch matchString: String!, tableView: UITableView!, at indexPath: IndexPath!) -> UITableViewCell! method and observing its contentOffset property. And as user scrolls down and reaches the end of the list, make pagination calls and call completionBlock earlier stored from asyncRetrieveEntities function call. This isn't the best way, but a plausible solution. Things to be careful about is removing observer on tableview.

saalisumer avatar Oct 13 '20 04:10 saalisumer