最佳答案
iOS 14 带有两个新的单元格配置:
UIContentConfiguration
顾名思义,内容配置可以帮助您操作单元格的内容,如图像、文本、辅助文本、布局指标和行为。
UIBackgroundConfiguration
可以帮助处理背景颜色、视觉效果、笔触、插图和圆角半径。即使我们没有指定,所有单元格都会继承默认的背景配置。
解决方案
要摆脱默认的 iOS14 白色背景,您需要更改
UITableViewCell
或 UITableViewHeaderFooterView
后台配置如下 // Add this code in your AppDelegate didFinishLauncingWithOptions
// or you can change configuration of certain subclass using self. backgroundConfiguration = ...
if #available(iOS 14.0, *) {
var bgConfig = UIBackgroundConfiguration.listPlainCell()
bgConfig.backgroundColor = UIColor.clear
UITableViewHeaderFooterView.appearance().backgroundConfiguration = bgConfig
//For cell use: UITableViewCell.appearance().backgroundConfiguration = bgConfig
}
阅读 this article更多
关于swift - iOS14 中表格部分标题中的白色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64355156/