UITableView Background Color

To change the background color of UITableView in iPhone application, you just need to write the given line of code into the tableView cellForRowAtIndexPath.

UITableView Background Color

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.