简体   繁体   English

IB中设置的UITableViewCell backgroundColor,设置为白色时显示黑色

[英]UITableViewCell backgroundColor set in IB, shows up black when it's set to white

Ok, so I don't understand why this happens sometimes. 好的,所以我不明白为什么有时会发生这种情况。 When you first drag in a UITableView into your .xib, the tableView background looks white. 当您第一次将UITableView拖到.xib中时,tableView背景看起来是白色的。 Then if you change it to another color, and try to switch back to the default with the slash in it, or even white, the TableView shows black. 然后,如果将其更改为另一种颜色,并尝试使用斜杠(甚至是白色)切换回默认设置,TableView将显示黑色。 See image 看图片 在此处输入图片说明

The tableview is set to white. 表格视图设置为白色。 The View for the view controller is set to white, yet I see black in the .xib. 视图控制器的“视图”设置为白色,但是我在.xib中看到黑色。 However when I actually run the app, it does show white correctly. 但是,当我实际运行该应用程序时,它确实可以正确显示白色。 It just bothers me that I see black like this and don't know why. 我看到这样的黑色,不知道为什么,这让我感到困扰。 Does this happen to other ppl? 这会发生在其他人身上吗? Thanks. 谢谢。

Yeah this happens quite frequently. 是的,这种情况经常发生。 It's not only related to the UITableViewCell but it can happen on all UIViews. 它不仅与UITableViewCell有关,而且可以在所有UIViews上发生。

I've stopped using the default value and instead select the actual color even though they are the same. 我已经停止使用默认值,而是选择了实际的颜色,即使它们相同。 It is only when selecting default it will give this kind of results. 只有选择默认值时,它才会给出这种结果。

Explicitly setting the background color setting to White solves the problem. 将背景颜色设置显式设置为白色即可解决该问题。

However I'd be interested to know the correct answer to the change in behavior of the default setting. 但是,我很想知道默认设置的行为更改的正确答案。

Basically switching background color back to 'default' color after having set it to black with unknown temporal circumstances, the background color doesn't switch back to the default white like when first dragged into storyboard. 在未知的时间环境下将背景颜色设置为黑色后,基本上将背景颜色切换回“默认”颜色,就像第一次拖动到情节提要中一样,背景颜色不会切换回默认白色。

I'm not able to find any setting related to the default behavior either. 我也找不到任何与默认行为相关的设置。 Could be a small bug? 可能是个小虫子?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM