diff --git a/VDS/Classes/Control.swift b/VDS/Classes/Control.swift index 10eb8ef9..1acca2d5 100644 --- a/VDS/Classes/Control.swift +++ b/VDS/Classes/Control.swift @@ -52,7 +52,10 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { /// Whether the Control is selected or not. open override var isSelected: Bool { didSet { setNeedsUpdate() } } - + + /// Whether the Control can handle the isHighlighted state. + open var canHighlight: Bool = true + open var touchUpInsideCount: Int = 0 var isHighlightAnimating = false @@ -60,7 +63,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { /// Whether the Control is highlighted or not.. open override var isHighlighted: Bool { didSet { - if isHighlightAnimating == false && touchUpInsideCount > 0 { + if canHighlight && isHighlightAnimating == false && touchUpInsideCount > 0 { isHighlightAnimating = true UIView.animate(withDuration: 0.1, animations: { [weak self] in self?.setNeedsUpdate() diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index d33bea63..7369202f 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -124,6 +124,9 @@ extension Tabs { open override func setup() { super.setup() + + canHighlight = false + addLayoutGuide(layoutGuide) addSubview(label) accessibilityTraits = .button diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 82a602b2..c4194496 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -140,7 +140,8 @@ open class Toggle: Control, Changeable { open override func setup() { super.setup() - + + canHighlight = false isAccessibilityElement = true accessibilityTraits = .button addSubview(label)