UILabel background color not updating in UITableView
- by Joey
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.