devopsinthecloud
devopsinthecloud copied to clipboard
Question - How to implement infinite scroll??
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.
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.