Gendolkari dequeue. , , KVC, .
, . , , , . [NSIndexPath description] . reuseIdentifier - , Objective-C, KVC:
[cell setValue:[[self.tableView indexPathForCell:cell] description] forKey:@"reuseIdentifier"];
, cellForRowAtIndexPath:
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];
, reuseIdentifier.
However, if we scroll down and then scroll back, we probably want to display the original cell that we removed from the dequeue loop. To do this, when we reuse the cell, we first try to delete the cell based on indexPath, and if we cannot find this attempt to deactivate the cell simply based on the base line of the cell identifier:
UITableViewCell *cell;
cell = [self.tableView dequeueReusableCellWithIdentifier:[indexPath description]];
if (!cell) cell = [self.tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];
If you want to return this cell to the dequeue loop, just change the reuseIdentifier to its original value:
[cell setValue:@"cellIdentifier" forKey:@"reuseIdentifier"];
source
share