4
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"fullscreen-bg.png"]];
self.tableView.backgroundColor = [UIColor clearColor];

That code worked fine in iOS 5 but it doesn't work in iOS 6. In iOS 6 it just show the default pinstriped background. Any ideas?

Steve Moser
  • 7,647
  • 5
  • 55
  • 94
  • Also I found that original code here: http://stackoverflow.com/questions/1813846/add-background-image-to-uitableviewcontroller-in-navigation-based-app – Steve Moser Sep 20 '12 at 20:40

2 Answers2

6
// FOR iOS 5
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.opaque = NO;

// FOR iOS 6
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];
self.tableView.backgroundView = nil;
Peter Warbo
  • 11,136
  • 14
  • 98
  • 193
  • Setting the tableView background color does work for grouped style table views. You end up with shadows all over the background. – Steve Moser Sep 21 '12 at 13:51
5

You can add the image as a background view

[tableView setBackgroundView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]]];

And That's it

Javier Beltrán
  • 756
  • 5
  • 26