¿Por qué initWithCoder no inicializa correctamente los elementos?

Tengo una subclase deUITableViewCell. Mi subclase contiene variosUILabels. Quiero que mi subclase inicialice estas etiquetas a algunas configuraciones predeterminadas que se aplican a cada celda de vista de tabla mía.

Leí que debería estar usandoinitWithCoder para esto. MiinitWithCoder Se está llamando a la función, y puedo pasar a través de cada línea en mi función y parece que va a través de los movimientos. Sin embargo, cuando ejecuto mi aplicación no veo ninguna de las propiedades que se aplican. Más notablemente, la fuente no se está cambiando. Simplemente no creo que ninguna de las propiedades que estoy modificando en miUILabelEn realidad, s se están guardando, o se muestran.

Estoy usando esta subclase junto con unaStoryboard. Sé que mis cambios no se reflejarán en elStoryboard, pero tampoco se reflejan cuando se ejecuta la aplicación, a pesar de que mi código se está ejecutando.

Edit: quería mencionar eso antes de intentar anularinitWithCoder, Tenía un método de instancia en estas subclases en el que ejecutaría esta lógica. Simplemente llamaría a ese método de instancia dentro decellForRowAtIndexPath. Este método estaba funcionando, pero pensé que sería útil que esta lógica en esta subclase ocurriera automáticamente.

¿Algunas ideas? Mi código está abajo:

#import "ThreadListCell.h"

@implementation ThreadListCell

- (id)initWithCoder:(NSCoder *)aDecoder {

    if ((self = [super initWithCoder:aDecoder])) {

        // adjust the font settings of the title
        self.title.font = [UIFont fontWithName:@"SourceSansPro-Black" size:16];
        self.title.textColor = [UIColor colorWithWhite:0.267f alpha:1.0f];

        // adjust the font settings of the subtitle
        self.text.font = [UIFont fontWithName:@"SourceSansPro-Light" size:14];
        self.text.textColor = [UIColor colorWithWhite:0.267f alpha:0.9f];
        self.text.textColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];

        // adjust the font settings of the location
        self.location.font = [UIFont fontWithName:@"SourceSansPro-Light" size:8];
        self.location.textColor = [UIColor colorWithWhite:0.267f alpha:0.9f];

        // adjust the UILabel settings of the title
        self.title.numberOfLines = 0;
        self.title.lineBreakMode = UILineBreakModeTailTruncation;

        // adjust the UILabel settings of the subtitle
        self.text.numberOfLines = 0;
        self.text.lineBreakMode = UILineBreakModeTailTruncation;

        // adjust the UILabel settings of the location
        self.location.numberOfLines = 0;
        self.location.lineBreakMode = UILineBreakModeTailTruncation;
        self.location.textAlignment = UITextAlignmentRight;

    }

    return self;

}

@end

Y el encabezado:

#import <UIKit/UIKit.h>

@interface ThreadListCell : UITableViewCell

@property (nonatomic, weak) IBOutlet UILabel *text;
@property (nonatomic, weak) IBOutlet UILabel *title;
@property (nonatomic, weak) IBOutlet UILabel *location;

@end

Respuestas a la pregunta(1)

Su respuesta a la pregunta