fix: status content warning UI for Dark Mode related issue

This commit is contained in:
CMK 2021-02-24 18:07:00 +08:00
parent 5bc8adfd43
commit 1345db9d7e
2 changed files with 11 additions and 1 deletions

View File

@ -103,7 +103,7 @@ final class StatusView: UIView {
// do not use visual effect view due to we blur text only without background
let contentWarningBlurContentImageView: UIImageView = {
let imageView = UIImageView()
imageView.backgroundColor = .secondarySystemGroupedBackground
imageView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
imageView.layer.masksToBounds = false
return imageView
}()
@ -126,6 +126,15 @@ final class StatusView: UIView {
super.init(coder: coder)
_init()
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
// update blur image when interface style changed
if previousTraitCollection?.userInterfaceStyle != traitCollection.userInterfaceStyle {
drawContentWarningImageView()
}
}
}

View File

@ -50,6 +50,7 @@ extension StatusTableViewCell {
private func _init() {
selectionStyle = .none
backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
statusView.contentWarningBlurContentImageView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
statusView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(statusView)