UITableViewCell initWithStyle: UITableViewCellStyleSubtitle no está funcionando
Tengo un problema al intentar mostrar información en una celda, una a la izquierda y otra a la derecha. Estoy consciente de que usoinitWithStyle
conUITableViewCellStyleSubtitle
. Yo uso esto pero no parece funcionar.
Aquí hay un código de ejemplo:
<code>- (UITableViewCell *)tableView:(UITableView *)ltableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Account Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:Cellidentifier]; } Accounts *account = [self.fetchedResultsController objectAtIndexPath]; cell.textLabel.text = account.name; cell.detailTextLabel.text = @"Price"; return cell; } </code>
Puedo mostrar cell.textLabel.text muy bien, sin embargo, no puedo obtener el simple "Precio" que se mostrará. He intentado cosas diferentes, como establecer el tamaño de fuente decell.detailTextLabel
.
También he intentadoUITableViewCellStyleValue1
como algunos habían sugerido en publicaciones anteriores. Lanzar NSLog después de establecer "Precio", muestra cell.detailTextLabel como nulo.
No estoy seguro de lo que estoy haciendo mal.
Edición: encontré esto:cell.detailTextLabel.text es NULL
Si me quitoif (cell == nil)
funciona ... Ese control debe estar en su lugar, entonces, ¿cómo lo hace funcionar al usar los diferentes estilos?