I have a UITableView which retrieves some data from a database which is relatively expensive to prefetch. To combat this problem I have used the design ideas from the LazyTableImages sample code to fetch data for visible rows when a scroll ends by using [UITableView visibleCells].

This works well in terms of performance, but it has two interaction problems i'd like to solve:

  1. The data isn't loaded until a scroll has come to a complete halt (i.e. scrollViewDidEndDecelerating). So if I scroll slowly through a list I have to stop the scroll to get the data to load into those visible cells. Ideally if the scroll was going at a slow speed i'd load the data into the cells.
  2. I'd like to prefetch maybe the 1 or two table cells data which are just off screen in anticipation of scrolling to them.

Is there a an elegant way to achieve this? I get the feeling I might be missing a common design pattern for this problem.

Edit
Report