dequeueReusableCellWithIdentifier:
Returns a reusable table-view cell object located by its identifier.
- (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier
Parameters
-
identifier
-
A string identifying the cell object to be reused. By default, a reusable cell’s identifier is its class name, but you can change it to any arbitrary value.
Return Value
A UITableViewCell
object with the associated identifier or nil
if no such object exists in the reusable-cell queue.
Discussion
For performance reasons, a table view’s data source should generally reuseUITableViewCell
objects when it assigns cells to rows in itstableView:cellForRowAtIndexPath:
method. A table view maintains a queue or list ofUITableViewCell
objects that the table view’s delegate has marked for reuse. It marks a cell for reuse by assigning it a reuse identifier when it creates it (that is, in theinitWithFrame:reuseIdentifier:
method of UITableViewCell
). The data source can access specific “template” cell objects in this queue by invoking thedequeueReusableCellWithIdentifier:
method. You can access a cell’s reuse identifier through its reuseIdentifier
property, which is defined by UITableViewCell
.
Availability
- Available in iPhone OS 2.0 and later.
Related Sample Code
Declared In
UITableView.h