UILabel's sizeToFit - only on re-used cells
UILabel's sizeToFit - only on re-used cells
- Subject: UILabel's sizeToFit - only on re-used cells
- From: Torsten Curdt <email@hidden>
- Date: Tue, 14 Jan 2014 20:20:53 +0100
I am seeing a weird behavior and I have hard time tracking down what's
going on. Any suggestion on how to pinpoint the problem would be great. I
am running out of ideas.
I have UITableView where I dequeue the cells.
MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"];
I then setup the cell
cell.myLabel.text = @"test";
cell.myLabel.textColor = [UIColor blackColor];
and resize the label to use the proper space for the content
[cell.myLabel sizeToFit];
Unfortunately `sizeToFit` seems to work only for the re-used cells. So when
I scroll them off screen, the cells coming back on screen are looking fine.
The initial cells don't - they have the labels at their initial size given
in interface builder.
I tried by setting "numberOfLines" or setting a larger frame to shrink from
but I cannot seem to get this to work. It's almost like the first
"sizeToFit" call gets ignored.
Any idea what could be going on?
cheers,
Torsten
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden