Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

ultranerd
1,060 PointsHow can I add a background image to the UITableViewController in Navigation based app?
As explained in the video -
UIImage *background = [UIImage imageNamed:@"background"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:background];
[self.view insertSubview:imageView atIndex:0];
The code works well for my View Controllers. But, need some advice for UITableViewController.
Screenshot - Imgur
2 Answers

Stone Preston
42,016 Pointsmaybe try doing something like this in your viewDidLoad method:
UIImage *background = [UIImage imageNamed:@"background"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:background];
[self.tableView setBackgroundView:imageView];
I havent tested it but it could work

ultranerd
1,060 PointsYes, I tried the same code (via Stackoverflow) and I get 'tableView not found on object of type'. So, the next question would be if I want to use self.tableview where should I declare tableView as my property?
property(nonatomic, strong) IBOutlet UITableView *tableView;
Thanks, Stone for speedy reply.

Stone Preston
42,016 PointsOk I assumed you were using a a tableView controller, but it appears you arent. where is your tableView currently being declared and initialized at? you may not have to create a property if you already have a table view being created somewhere