Does each unique reuse identifier have its own unique reuse queue?

Viewed 317

Answer

Yes. A unique reuseIdentifier corresponds to a unique reuse queue.

According to Apple's documentation for UITableViewCell's reuseIdentifier:

A UITableView object maintains a queue (or list) of the currently reusable cells, each with its own reuse identifier, and makes them available to the delegate in the dequeueReusableCellWithIdentifier: method

Answer was provided by user Matt and the source was indirectly linked in a SOF answer. The latter was posted by user prekshya basnet.


Question's Elaboration

Does each reuseIdentifier correspond to a unique reuse queue?

In other words: is it possible to call register(_:forCellReuseIdentifier:) with its either implementations for registering nibs or for registering classes with different combinations of parameters on the same UITableView instance? knowing that said combinations of parameters satisfy the following:

  • Identical nib or cellClass value in each call, depending on the used implementation for said UITableViewController.
  • Unique identifier for each call

Question's Trigger

According to Apple's programming guide: A Closer Look at Table View Cells in Cells and Table View Performance section at the very end of the guide, the following guidelines are encouraged:

  1. Reuse cells.
  2. Avoid relayout of content.
  3. Use opaque subviews.
  • In order to satisfy the aforementioned guideline items 1. and 2.
  • In order to satisfy my requirement that is to have two cells of the same type but are are layed out progamatically in a different way even though they are the same XIB and UITableView subclass.

Then I need to use two distinct reuseIdentifier strings for the same nib object.

I can already differentiate between the two nib objects, that are layed out differently, in UITableViewDelegate or UITableViewDataSource using a control flag/enum in the object residing in my dataSource backstore collection. This object of course corresponds to the indexPath referenced inside the delegate/dataSource.

Question's Previous Work

I have scoured the internet using multiple search engines on multiple websites including Stackoverflow. I have already checked the following questions: what registering a call for cell reuse actually do and registered classes for reuse identifiers and many other more that were too distant to even mention.

1 Answers

Does each reuseIdentifier correspond to a unique reuse queue?

Yes. That is exactly what the reuse identifier is: it is the name of one pile of cells available for reuse.

Related