I have a problem with the background color of my table view. I have set the background color in Interface Builder and it displays correctly there. However, when I launch my application, there is no background color (this is the default white color).
I found that I can set the background color in the table table delegate file:
tableView.backgroundColor = [UIColor lightTextColor];
The problem with this is that I want to use one of the colors from the Crayon palette.
So, is there a reason why the background color does not appear in the first place? Or, if I need to override it, as my sample code is above, how can I set it to one of the Crayon colors?
Any help is much appreciated!
I just realized that IB will tell you the RGB values ββof any colors, you just need to switch the slider from the gray slider to the RGB slider when adjusting the colors. I did not even understand that this is an option. So, the beginnerβs lesson has been learned!
Well, in my case, I wanted to color my Mercury table. For this, I used IB to tell me what the RGB value of this color is (change the slider from gray to RGB). The RGB values ββfor Mercury were 230, 230, 230. Then I changed the Jason code and put it in the numberOfRowsInSection method of my tableView delegate.
tableView.backgroundColor = [UIColor colorWithRed:230.0f/255.0f green:230.0f/255.0f blue:230.0f/255.0f alpha:1.0f];
What should be noted: Do not forget to include your f! Otherwise, you will end up with all zeros - otherwise, black.
It worked like a charm, thanks!