How cells are reused in tableView:cellForRowAtIndexPath


#1

I’m wondering about how exactly cells are reused in the tableView:cellForRowAtIndexPath method.

Say, initially, there are four cells on the screen and, as there were no cells on-screen beforehand, these are all alloc’d and init’d as one would expect. Then, the user scrolls down by one entry, pushing the top cell off of the screen and bringing in a new one.

[ 1. off-screen ]

[ 2. original ]
[ 3. original ]
[ 4. original ]
[ 5. new! ]

After the scroll, is the tableView:cellForRowAtIndexPath called for every single row again? (Therefore reloading the contents of cells 2–4 which never changed…) Or, does iOS know that cell 2–4 were loaded previously so it just moves them…