mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2024-12-25 00:13:28 +01:00
Fix highlight behavior
This commit is contained in:
parent
a29e88b60b
commit
946d47abdd
@ -33,7 +33,15 @@ public final class StatusCardControl: UIControl {
|
|||||||
private var layoutConstraints: [NSLayoutConstraint] = []
|
private var layoutConstraints: [NSLayoutConstraint] = []
|
||||||
|
|
||||||
public override var isHighlighted: Bool {
|
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) {
|
public override init(frame: CGRect) {
|
||||||
@ -53,7 +61,7 @@ public final class StatusCardControl: UIControl {
|
|||||||
maximumContentSizeCategory = .accessibilityLarge
|
maximumContentSizeCategory = .accessibilityLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightView.backgroundColor = UIColor.black.withAlphaComponent(0.1)
|
highlightView.backgroundColor = UIColor.label.withAlphaComponent(0.1)
|
||||||
highlightView.isHidden = true
|
highlightView.isHidden = true
|
||||||
|
|
||||||
titleLabel.numberOfLines = 2
|
titleLabel.numberOfLines = 2
|
||||||
|
Loading…
Reference in New Issue
Block a user