Cell label background off-colour?


#1

Hi,

I’ve run through the chapter fine, and everything functions correctly. One this that seems to have gone awry is the background colour of the labels on the contentView - whereas the table background seems to be a very slight grey (RGB = 247), the labels have a plain white background. A portion of a screenshot of the simulator is here:

(I added the black on the bottom for illustration, with labels to point out the colours - this picture has my fix below on the valueLabel for demonstration).

I’ve found I can fix this by setting the UILabel background explicitly:

[nameLabel setBackgroundColor:[UIColor colorWithRed:(247./255.) green:(247./255.) blue:(247./255.) alpha:1.0]];
but this seems rather hackish and doesn’t seem to be mentioned at all in the book. Am I missing something, or perhaps there has been a change in the transition to iOS 5 and XCode 4.2 that I am not accounting for somehow?

Edit: I found that setting:

in initWithStyle:reuseIdentifier: fixes the issue neater (tried this but with nil, which apparently didn’t work) but am still not sure why it appears to not be necessary for the book.


#2

The solution is using the clear color. It might be the default settings in your XIB file that change the color to something else - I don’t see the same thing on my machine.


#3

Thanks - good to know I appear to be doing the right thing.