Reusing UITableViewCells


#1

Hi,
I occasionally come back and visit this book for info and to enhance my understanding. if you look at page 201 of the book
where it talks about reusing cells to lower memory footprint of the app. I have this question:

the OS will dequeue cells as they go off the screen, does that mean the object that is represented by those cells is deallocated too?

assume we have 3000 BNRItems, every time we scroll the OS reuses cells, should I assume that means there will be a limited number of BNRItems in memory equal to number of cells visible on the screen?


#2

No, the objects themselves aren’t dealloc’d, because BNRItemStore maintains a strong reference to them in the allItems array.

The main reason to reuse cells is because the graphical representation of a table cell takes up a lot of memory, far more than simple data objects.

If the data was dealloc’d just from going off-screen, think what a nightmare that would introduce to your program to constantly reset allItems as the screen moves up and down.