【发布时间】:2024-01-14 16:14:01
【问题描述】:
我在更改 UITableViewCell 的背景颜色时遇到问题。
我将 Cell 的背景颜色设置为 UIColor.systemGray6 但是披露指示器周围的颜色仍然是白色。但在暗模式下,它可以正常工作,如下图所示:
这是包含披露指示符的单元格代码:
class SettingsDiscolsureCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
self.contentView.backgroundColor = UIColor.systemGray6
self.textLabel?.font = UIFont(name: "AvenirNext", size: UIFont.labelFontSize)
self.accessoryType = .disclosureIndicator
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
我尝试了self.accessoryView?.backgroundColor = .systemGray6,但发现发生了变化
为什么会发生这种情况,我应该怎么做才能改变整个背景颜色?
【问题讨论】:
标签: ios swift uitableview uikit