What are the exact circumstances in which I can reuse a cell (using dequeueReusableCellWithIdentifier
in the UITableView class)?
views:
23answers:
1
+1
A:
That a cell is available for reuse with the identifier you pass in. Your only requirement is to use the same identifier for the same type of cell you want.
Just remember, if one wasn't available for reuse, you need to create one.
jer
2010-09-27 00:00:53
What exactly does "same type of cell" mean?
Casebash
2010-09-27 00:07:26
If you have to ask that, you probably only have one type of cell. By "same type of cell" I mean, for instance, if you a cell which has a label on the left and a text field on the right, and another cell which contains just a button. That (could be) two different types of cells, which should have different reuse identifiers. Typically you do this when you have different elements in the cell.
jer
2010-09-27 00:21:51
@jer: What if the only difference is that the cell size is different? Can I reuse the cell (resizing it of course)? If so, will this offer any performance benefit?
Casebash
2010-09-27 00:37:48
Height doesn't matter in terms of cell reuse, since the cells are sized when they're displayed automatically based on your tableview delegate.
jer
2010-09-27 01:20:26