add background image to UITableViewController in Navigation based app
It's a little different in a navigation based app: just change the background of the navigation view that each table view is sitting on. Placing the following code in viewDidLoad
of each UITableViewController works:
self.navigationController.view.backgroundColor =
[UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]];
self.tableView.backgroundColor = [UIColor clearColor];
But you may only need to do it once, at the top level of the navigation controller, rather than in each tableview controller (although you'll still have to set each background to clear).
On iOS6 use this:
UIImageView *boxBackView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TextureBoxboard.jpg"]];
[self.tableView setBackgroundView:boxBackView];
If your class is a UIViewController subclass then you can do it like this:
[self.view setBackgroundColor:
[UIColor colorWithPatternImage:
[UIImage imageWithContentsOfFile:
[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:
@"background.png"]]]];