forked from shadowfacts/Tusker
parent
0c9f6e02bd
commit
ba1eed7a85
|
@ -394,6 +394,8 @@ class CustomAlertActionButton: UIControl {
|
||||||
self.isContextMenuInteractionEnabled = true
|
self.isContextMenuInteractionEnabled = true
|
||||||
self.showsMenuAsPrimaryAction = action.handler == nil
|
self.showsMenuAsPrimaryAction = action.handler == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addGestureRecognizer(UIHoverGestureRecognizer(target: self, action: #selector(hoverRecognized)))
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
|
@ -429,6 +431,17 @@ class CustomAlertActionButton: UIControl {
|
||||||
super.contextMenuInteraction(interaction, willEndFor: configuration, animator: animator)
|
super.contextMenuInteraction(interaction, willEndFor: configuration, animator: animator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func hoverRecognized(_ recognizer: UIHoverGestureRecognizer) {
|
||||||
|
switch recognizer.state {
|
||||||
|
case .began, .changed:
|
||||||
|
backgroundColor = .secondarySystemFill
|
||||||
|
case .ended:
|
||||||
|
backgroundColor = nil
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
super.touchesBegan(touches, with: event)
|
super.touchesBegan(touches, with: event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue