How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
We need to do something about that plain background. We're going to use a PNG image and display it behind the UITableView.
Disappointingly, you won't be able to see your background. The UITableView's background is blocking us from seeing the UIImageView. There are three changes you need to make:
Set the UITableView's background color to transparent:
tableView.backgroundColor = [UIColor clearColor];
I hope this helps and solves your problem. It has worked for me and I have yet to find a more elegant way to display a background image for a UITableView.
The advantage of my solution, in comparison with setting a background image directly on the UITableView, is that you can indent the table's content. I often wanted to do this to just show two or three table cells at the bottom of the screen.
[tableView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"whatever.png"]]];
One way would be to make the table view transparent (set the view's background to 0% opacity) and place a UIImageView behind the UITableView. Remember that transparent tables and table cells will not perform as well as opaque ones.