I have a navigation based app where I push UITableViewControllers
onto the stack. I would like to add a background UImage
to all of my UITableViewControllers
. Not a UIColor
, but an UImage
. I know how I can do this using a Nib
file and setting the UITableView
itself to have use [UIColor ClearColor]
, but I don't want to go through all my UITableViewControllers
and change them to using Nib
files, etc.
I also found this solution which would be great if I was just using a single tableviewcontroller in my app. I think there might be a way to make this work, by adding a subview "below" my table view that is created by default in a UITableViewController
?
Any suggestions would be great.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With