Please tell me the exact content ... (Other power application)
If you try to create a tableView cell by creating an instance every time, it will become heavier and heavier as the number of cells increases. So I think it was a story about "reusing" cells.
I implemented a scrolling table using a very convenient library called SpreadsheetView. The table to be implemented is of the type with some empty space (like a timetable). If you scroll, the empty space will be filled up more and more! Every time I scroll, it fills up more and more, and in the end it seems that there is almost no space ...
After calling the cell, put empty data in the empty space.
From here, I'm guessing because I haven't verified it properly or studied it. (1) "Reusing" a cell means reusing it including properties. (Since it does not create a new instance, the property will not be initialized unless you write the initialization process) (2) The cellForRowAt method was called every time I scrolled (this has been confirmed). Probably, cellForRowAt is called for the cell that appears at the timing when the part that disappeared before scrolling appears. ③ Because it is "reused", the property at the time of reuse is applied when drawing the empty space → Will the empty space fill up more and more? ??
Therefore, by replacing the properties at the time of reuse with empty data, it can be safely kept empty even if it is redrawn.
Can anyone please tell me the exact content ... (I will study it later m (_ _) m)
Recommended Posts