I have in a SQLite database more than 10,000 records with products, and in a folder I have the images of said products, only I cannot load them all in one UiTableView
in Objective C.
I know that what I should do is load only the ones the user is going to see and a few more for when they scroll, but I can't find any example code for this, and my English is not that great.
For now I am only loading a limit of 1500 records in a NSArray
, so that the device memory is not overloaded, but I need to be able to view all the products and that they load as I scroll (without loading times).
Does anyone know how to do this? What control do you have to use? Is the used for this?, or do I make queries every time the scrollNSCache
moves , I'm not very clear on how to do it, I load the images from a project folder, so there's not much of a problem, I just tell the load from there, with the product reference.imageview
From the official apple docu .
This is achieved with
- (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier;
With this we are reusing cells. That means that you are not going to have 10000 cells in memory but you are going to have only the ones that are visible to the user.
An example from the official document is
If you use the storyboard it is as simple as setting the reuseIdentifier If you were not using the storyboard you would have to register the cell in the tableView