Reputation: 1245
tableview .BackgroundColor:[UIColor colorWithRed:1 green:1 blue:0.75 alpha:1];
This is my code for changing background color of UItableview. But I don't get the color change when I use this code, it looks the default white color. Is there any mistake in my code?
Upvotes: 0
Views: 176
Reputation: 521
To follow up on both other posters, who are correct, you may also need to set the background to nil. E.g.,
tableView.backgroundView = nil;
Upvotes: 1
Reputation: 195
Also, in addition to correcting the syntax, If the table is filled with opaque cells the background will not show. Of course this depends on the rest of your code. The simpelest way of testing this is to let the tableviewcontroller datasource return 0 for the number of sections in the table
Upvotes: 0
Reputation: 52227
to answer your question correctly: Yes there is a mistake.
This code is not valid at all. It has no correct syntax.
It should look like this
tableview.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0.75 alpha:1];
or
[tableview setBackgoundColor: [UIColor colorWithRed:1 green:1 blue:0.75 alpha:1]]:
Upvotes: 3