如何在iOS 6中将背景图像添加到分组样式UITableViewController?

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

该代码在iOS 5中运行良好,但在iOS 6中无法运行。在iOS 6中,它只显示默认的细条纹背景。 有任何想法吗?

您可以将图像添加为背景视图

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

而就是这样

 // 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;