为什么 UITableViewCell 背景颜色不起作用(在界面生成器中设置)?

编程入门 行业动态 更新时间:2024-10-28 16:21:43
本文介绍了为什么 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 背景颜色不起作用(在界面生成器中设置)?

本文发布于:2023-11-06 04:28:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562719.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   器中   界面   颜色   背景

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!