Joe
Joe

Reputation: 864

Why is layoutSubViews not being called in my UITableViewCell subclass?

I've used some breakpoints and found that the cell's init method DOES in fact get called, so I know my tableview is using the custom tableView cell class. Here's the class implementation:

#import "FCTableViewCell.h"

@implementation FCTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.textLabel.frame = CGRectMake(10.0, 19.0, 240.0, 27.0);

    // Initialization code
    }
return self;
}

-(void)layoutSubViews
{

    [super layoutSubviews];
    self.textLabel.frame = CGRectMake(10.0, 19.0, 240.0, 27.0);
    self.textLabel.adjustsFontSizeToFitWidth = YES;
    self.textLabel.minimumScaleFactor = 0.8;
    self.textLabel.textAlignment = NSTextAlignmentCenter;
    self.textLabel.font = [UIFont fontWithName:@"Avenir" size:21.0];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

Upvotes: 0

Views: 1456

Answers (1)

Bo A
Bo A

Reputation: 3154

It's layoutSubviews not layoutSubViews. Case matters in Objective-C.

Upvotes: 5

Related Questions