I've a UITableView
and each UITableViewCell
displays a unique UIImage
which is fetched from internet. As we scroll the UITableView
, cells are recreated and tableView: cellForRowAtIndexPath:
gets called every time to configure cells. So it loads UIImages
again and again from internet and scrolling is not smooth.
The solution I found for myself right now is to create NSMutableArray
of all those UIImages
on ViewDidLoad
then load images into UITableViewCells
from that NSMutableArray
which is for sure giving me smooth scrolling.
My concern with my own solution is that when I keep all UIImages
in NSMutableArray
and those all objects are kept in memory for as long as application runs, I am most probably making inefficient use of memory.
Is there a better, more efficient way to do this which gives me smooth scrolling as well as best memory usage?