En la programación de iOS, ¿por qué hay una etiqueta en el celular? Agregar un valor a una etiqueta por su valor aún resulta en duplicación.
El mecanismo de reutilización reutiliza celdas basadas en el mismo identificador, pero las celdas con identificadores diferentes no se pueden reutilizar entre sí. Por lo tanto, podemos evitar el problema de reutilizar diferentes celdas configurando un identificador diferente para cada celda.
- (UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
NSString * CellIdentifier = [NSString stringWithFormat: @ "Cell_d_d", indexPath.section, indexPath.row]; // Por ejemplo, podemos identificar de forma única una celda configurando su identificador. Identificar celdas de forma única a través de indexPath
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier] // genera la celda reutilizable
if (cell == nil) {
cell = [[ UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier]
}
//...Otro código
return cell;< / p>
}.