fix: setting scene background color not elevated under Dark Mode issue

This commit is contained in:
CMK 2021-06-08 17:26:12 +08:00
parent c4e38e76ee
commit 0b77c19857
3 changed files with 12 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class SettingsViewController: UIViewController, NeedsDependency {
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.delegate = self
tableView.rowHeight = UITableView.automaticDimension
tableView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
tableView.backgroundColor = .clear
tableView.register(SettingsAppearanceTableViewCell.self, forCellReuseIdentifier: String(describing: SettingsAppearanceTableViewCell.self))
tableView.register(SettingsToggleTableViewCell.self, forCellReuseIdentifier: String(describing: SettingsToggleTableViewCell.self))
@ -185,7 +185,14 @@ class SettingsViewController: UIViewController, NeedsDependency {
}
private func setupView() {
view.backgroundColor = Asset.Colors.Background.secondarySystemBackground.color
view.backgroundColor = UIColor(dynamicProvider: { traitCollection in
switch traitCollection.userInterfaceLevel {
case .elevated where traitCollection.userInterfaceStyle == .dark:
return Asset.Colors.Background.systemElevatedBackground.color
default:
return Asset.Colors.Background.secondarySystemBackground.color
}
})
setupNavigation()
view.addSubview(tableView)

View File

@ -176,7 +176,7 @@ class SettingsAppearanceTableViewCell: UITableViewCell {
// MARK: Private methods
private func setupUI() {
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
backgroundColor = .clear
selectionStyle = .none
contentView.addSubview(stackView)

View File

@ -39,7 +39,8 @@ class SettingsSectionHeader: UIView {
init(frame: CGRect, customView: UIView? = nil) {
super.init(frame: frame)
backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
backgroundColor = .clear
stackView.addArrangedSubview(titleLabel)
if let view = customView {
stackView.addArrangedSubview(view)