James
James

Reputation: 331

UITableview with static cells - label text doesn't show up before I tap on cells

I have a table with static cells. I also have a button that sets the textLabel.text property for each of the cells.

When i press that button, nothing happens visually, even though the labels were really changed.

And here's the weird thing: If i tap on the cell, the value suddenly shows. So i have to tap on each cell to reveal the label text. Now I can tap on the button again (which changes the labels), and it will work fine - I only need to tap the cells the first time, and then they stay "activated".

Upvotes: 0

Views: 507

Answers (1)

Carl Veazey
Carl Veazey

Reputation: 18363

Try calling [cell setNeedsLayout] after you change the text. The cell will size its label to CGSizeZero in layoutSubviews if its textLabel's text is nil.

Upvotes: 3

Related Questions