La cadena atribuida en tableviewcell no muestra texto en negrita hasta que la celda se retira y se vuelve a cargar
Tengo una vista de tabla, en la que las celdas tienen una etiqueta con texto atribuido. El texto se está configurando correctamente desdecellForRowAtIndexPath
. El color del texto se está configurando correctamente, pero el atributo en negrita no se muestra hasta que se quita la celda.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
Model *model = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.tag = indexPath.row;
[cell updateContentWithModel:model atIndexPath:indexPath];
return cell;
}
- (void)updateContentWithModel:(Model *)model atIndexPath:(NSIndexPath *)indexPath
{
self.model = model;
[self setTextFromModel];
[self setImageFromModelAtIndexPath:indexPath];
}
- (void) setTextFromModel
{
self.title.text = self.model.header;
self.status.attributedText = [self boldString:self.model.status fontSize:self.status.font.pointSize color:[UIColor redColor]];
}
+(NSMutableAttributedString *)boldString:(NSString *)stringToBold fontSize:(CGFloat)fontSize color:(UIColor *)color
{
NSMutableAttributedString *boldString = [[NSMutableAttributedString alloc] initWithString:stringToBold];
[boldString setAttributes:@{NSForegroundColorAttributeName: color,
NSFontAttributeName:[UIFont boldSystemFontOfSize:fontSize]} range:NSMakeRange(0, boldString.length)];
return boldString;
}
¿Alguien ha experimentado algo como esto antes?