简体   繁体   English

XCode 12 和 IOS 14 中 UITableView 的问题

[英]Problem with UITableView in XCode 12 and IOS 14

I have a problem after upgrading to XCode 12 and IOS 14.升级到 XCode 12 和 IOS 14 后出现问题。

I normally set the background of a UITableView to .clear, for example:我通常将 UITableView 的背景设置为 .clear,例如:

  @IBOutlet weak var testTableView: UITableView!

and then in the viewDidLoad function:然后在 viewDidLoad 函数中:

testTableView.backgroundColor = .clear

This worked just fine for me.这对我来说很好。 But since upgrading to XCode 12 and IOS 14 the background stays standard white until scrolling then it changes to .clear .但是自从升级到 XCode 12 和 IOS 14 后,背景在滚动之前保持标准白色,然后变为 .clear 。

I didn't changed anything in my Code and with XCode 11 I didn't had this issue.我没有更改我的代码中的任何内容,使用 XCode 11 我没有遇到这个问题。

Does anyone has the same problem and figured out how to fix it?有没有人有同样的问题并想出如何解决它?

thank you in advance先感谢您

Update: Thank you all for your help.更新:谢谢大家的帮助。

I've fixed it!我修好了! It actually was a problem with the custom TableViewCell I don't know how I assumed that it was the general background of the TableView.(Thanks @Starsky for the hint with custom Cell - i guess you all know after hours of searching for minor bugs you can't come up with the simplest things hahaha).这实际上是自定义 TableViewCell 的一个问题,我不知道我是如何假设它是 TableView 的一般背景的。(感谢@Starsky提供自定义 Cell 的提示 - 我想你们在搜索小错误数小时后都知道了你想不出最简单的东西哈哈哈)。 In the override init() function of the custom cell I called self.backgroundColor = .none which caused the bug after setting it to self.backgroundColor = .clear everything works as planed.在自定义单元格的override init()函数中,我调用了self.backgroundColor = .none这在将其设置为self.backgroundColor = .clear后导致了错误,一切都按计划进行。

i also phase this problem i solve it by this:我也分阶段解决了这个问题:

~ you should not try this programitically ~ try from storyboard to clear color ~你不应该以编程方式尝试这个 ~ 尝试从故事板到清晰的颜色

it solved my problem.它解决了我的问题。

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

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