Claudio
Claudio

Reputation: 2037

Custom Cell not resizing UILabel's

I'm designing a custom cell on my storyboard and it's not resizing my labels according to its text's size. I'm using this code:

- (void)awakeFromNib {
    titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
    titleLabel.numberOfLines = 0;
    [titleLabel sizeToFit];
    //[titleLabel setBackgroundColor:[UIColor grayColor]]; -- I put this code here just to be sure that awake from nib is working
}

Should I implement something else?

Regards!

Upvotes: 0

Views: 211

Answers (1)

cahn
cahn

Reputation: 1369

You should call sizeToFit in layoutSubviews method.

Upvotes: 1

Related Questions