如果我在一个分组的UITableViewCell上设置了backgroundColor属性,背景色会成功更改。很好。
但是我想使用UIAppearance在所有的UITableViewCells中更改背景色,因此我可以在一个地方执行更改并影响到每个地方。以下是我的代码:
[[UITableViewCell appearance] setBackgroundColor:[UIColor colorWithRed:30.0/255.0 green:30.0/255.0 blue:30.0/255.0 alpha:1.0]];
UITableViewCell实现了UIAppearance和UIAppearanceContainer,因此我本以为这会起作用。但是它没有。我还尝试使用-[UITableViewCell appearanceWhenContainedIn:(Class)]
,但也没有起作用。
有什么想法吗?
setBackgroundColor
来进行代码演示。 - lxtUITableViewCell
的头文件吗? - lxt