How do I add a background image to a grouped style

2019-04-09 18:23发布

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?

标签: ios ios6
2条回答
Fickle 薄情
2楼-- · 2019-04-09 19:00

You can add the image as a background view

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

And That's it

查看更多
Emotional °昔
3楼-- · 2019-04-09 19:12
// 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;
查看更多
登录 后发表回答