Why doesn#39;t UITableViewCell background color work (set in interface builder)?(为什么 UITableViewCell 背景颜色不起作用(在界面生成器中设置)?)
问题描述
为什么 UITableViewCell 背景颜色不起作用(在界面生成器中设置)?
Why doesn't UITableViewCell background color work (set in interface builder)?
我从一些搜索中注意到,在您的 UITableViewController 的自定义子类中设置的以下代码确实有效(见下文):
I note from some searching 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 背景颜色不起作用(在界面生成器中设置)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么 UITableViewCell 背景颜色不起作用(在界面生成器中设置)?


- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01