To change the background color of UITableView in iPhone application, you just need to write the given line of code into the tableView cellForRowAtIndexPath.
tableView.backgroundColor = [UIColor grayColor];
The above line will change the default background color into gray color. You can also set the gradient to it.
In this example we are simply changing the color of all the cells or table view background. But you can also draw different styles to it.. table view also provides properties that allows you to add image at background.
On building the application it should look like the given image..
In the image two you can see that on click, cell is showing different color or highlighted. This can be done by setting the cell color on click.
//To Set Selected Background Color
UIImageView *selectedBackground = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320,100)];
selectedBackground.backgroundColor = [UIColor orangeColor];
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.