Group table view background color is deprecated in

2019-03-11 07:11发布

问题:

Possible Duplicate:
is groupTableViewBackgroundColor deprecated on iOS 6?

I am getting this warning on my storyboard in iOS 6. I would hover to see the replacement method, but since I'm viewing the storyboard it shows me nothing. How can I easily set the background color? Seems like I should be able to do this from the Interface Builder.

回答1:

Open your storyboard, check all views in the Attributes Inspector and change all views with Grouped Table View background color to any other color, I changed mine to white and all warnings went away.



回答2:

In code you can set it using the following:

tableView.backgroundColor = [UIColor blueColor];
tableView.backgroundView = nil;


回答3:

I've noticed, that in iOS simulator the groupTableViewBackgroundColor is not shown in iOS 6 but in iOS 5. On a device with iOS 6 it still looks like in iOS 5. An interesting point is, that the simulator still shows the groupTableViewBackgroundColor in grouped tables, so I think it is just not allowed to use this color for other views than grouped table views in iOS 6.