UILabel background color not updating in UITableView
Posted
by Joey
on Stack Overflow
See other posts from Stack Overflow
or by Joey
Published on 2010-05-04T21:37:16Z
Indexed on
2010/05/04
21:38 UTC
Read the original article
Hit count: 394
I'm having a perplexing problem with a simple UILabel I put on a cell in a UITableView. I enter a separate view after tapping on a row, like many UITableViews. In there, I update the cell so that when I return to the rows, it should be updated, with this:
MyTableViewCell* cell =
(MyTableViewCell*) [mTableView cellForRowAtIndexPath:
[NSIndexPath indexPathForRow:mActiveRow inSection:0]];
cell.myLabel.text = @"New Value"; // updated text
cell.myLabel.backgroundColor = [UIColor greenColor]; // updated color
When I return, though, only the text is updated, not the color. When I scroll the row off the screen and return it refreshes properly via another path of code that has exactly the same code. Could there be some trigger to refresh specifically the background color of the UILabel? I'm not sure why the text will refresh but the color won't.
© Stack Overflow or respective owner