为什么UITableViewCell背景颜色不起作用(在界面构建器中设置)? [英] why doesn't UITableViewCell background color work (set in interface builder)?
问题描述
为什么UITableViewCell背景颜色不起作用(在界面构建器中设置)?
Why doesn't UITableViewCell background color work (set in interface builder)?
我从一些谷歌搜索中注意到UITableViewController的自定义子类中设置的以下代码work(见下文):
I note from some googling that the follow code set in your custom subclass of UITableViewController does work (see below):
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor redColor];
}
但我仍然想了解为什么界面构建器具有背景颜色设置对于TableViewCell,它实际上似乎没有用?
But I would still like to just understand why interface builder has a background color setting for the TableViewCell, which effectively doesn't seem to work?
谢谢
推荐答案
(试试这个)
Apple的IB设计是通用的,适用于多种组件,也面向高技术受众(开发人员)。因此,尚未设计(作为应用程序)为每个组件/情况类型完全自定义接口。因此,在这种情况下,看似设置背景颜色的能力有点误导。
Apple's IB's design is generic to be applied to multiple kinds of components, and is also targeted at a highly technical audience (developers). Hence it has not been designed (as an application) to fully customise the interface properly for each component/situation type. So in this case it is the case the ability to seemingly set the background-color is somewhat misleading.
这篇关于为什么UITableViewCell背景颜色不起作用(在界面构建器中设置)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!