1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-24 16:01:52 +01:00

Fix highlight behavior

This commit is contained in:
Jed Fox 2022-12-02 22:35:18 -05:00
parent a29e88b60b
commit 946d47abdd
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1

View File

@ -33,7 +33,15 @@ public final class StatusCardControl: UIControl {
private var layoutConstraints: [NSLayoutConstraint] = []
public override var isHighlighted: Bool {
didSet { highlightView.isHidden = !isHighlighted }
didSet {
// override UIKit behavior of highlighting subviews when cell is highlighted
if isHighlighted,
let cell = sequence(first: self, next: \.superview).first(where: { $0 is UITableViewCell }) as? UITableViewCell {
highlightView.isHidden = cell.isHighlighted
} else {
highlightView.isHidden = !isHighlighted
}
}
}
public override init(frame: CGRect) {
@ -53,7 +61,7 @@ public final class StatusCardControl: UIControl {
maximumContentSizeCategory = .accessibilityLarge
}
highlightView.backgroundColor = UIColor.black.withAlphaComponent(0.1)
highlightView.backgroundColor = UIColor.label.withAlphaComponent(0.1)
highlightView.isHidden = true
titleLabel.numberOfLines = 2