A
A
Alexander Zarochintsev2014-05-16 11:35:04
Objective-C
Alexander Zarochintsev, 2014-05-16 11:35:04

UITableView - how to increase cell cache?

Good time of the day! In general, there is an application with UITableView and the problem is that the table sees only those cells that fit on the screen, + 2-3, and when scrolling it removes the rest from memory, is it possible to increase the size, say, to 30 cells?
Thank you for your attention!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
ManWithBear, 2014-05-16
@ManWithBear

Why not keep all the information somewhere separate?
And you can get more details: why do you need it, where does the content of the cells come from, and so on. ?

A
An, 2014-05-19
@Flanker_4

You are confusing cause and effect due to a lack of understanding of how table view works.
This is not a list, as you might think, but rather a drum. A cell that goes up, out of the scope, immediately teleports down and leaves from there (as if you are interfering with a deck of cards). Therefore, the creation and filling of a cell in the data source is so "strange". although in recent versions this complexity was hidden behind sugar. And that can't be changed in a UITableView though....
So, back to your problem: You don't need to increase the cache or build a fire around uitableview cells - that's a road to nowhere.
You just need to separate the cutlets from the flies.
have an object or dictionary (as suggested by @ManWithBear), which will describe the state of the cell. the so-called model. Example: for a cell with three checkboxes, this will be an object with three boolean properties.
Further, when clicking on any of the checkboxes, change the corresponding property of the object (remember the change). And when displaying a cell, pull out this boolean value and set the switches to the desired value. And you won't believe it, but the calendar in ios works exactly like this, only the model is there in the coredata's casket.

D
Denis Morozov, 2014-05-28
@morozovdenis

I support the two previous answers
<beginning of bad advice>
but if you really want to physically create as many cells as your table can have, then assign a unique reuseIdentifier to each cell.
<end of bad advice>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question