Any problem with UITableView
scrolling performance can be solved using techniques already described in other answers. However many a times sluggish performance is caused by something inherently erroneous, or repetitive.
The fact that UITableView
reuses the cells, and the fact that each cell may need its own image - together makes the solution bit complex. From how it's being solved the general way, here I summarize things that should be taken care of:
- Load data into data source - from REST / database. This step should be done on background, eventually using dispatch_async along with GCD queue.
- Create and initialize relevant data model objects and putting them inside an array
[tableView reloaddata]
- Inside
cellForRowAtIndexPath
, include code that will set data (text) from correct data model object of the array.
- Now images maybe in the form of URL too, so this step might be little quirky because of cell reuse done by table view. The heart of the fact is to load once again image from device cache / URL using async queue, then set it to correct cell.image (whatever is your cell image property).
To avoid problems, refer to this tutorial about lazy loading of images inside table view.