added animation block for updateview
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
bffd7f8dd9
commit
de9b57362c
@ -43,9 +43,23 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
open var surface: Surface = .light { didSet { didChange() }}
|
open var surface: Surface = .light { didSet { didChange() }}
|
||||||
|
|
||||||
open var disabled: Bool = false { didSet { isEnabled = !disabled } }
|
open var disabled: Bool = false { didSet { isEnabled = !disabled } }
|
||||||
|
|
||||||
open override var isHighlighted: Bool { didSet { if isHighlighted != oldValue { updateView() } } }
|
var isHighlightAnimating = false
|
||||||
|
open override var isHighlighted: Bool {
|
||||||
|
didSet {
|
||||||
|
if isHighlightAnimating == false {
|
||||||
|
isHighlightAnimating = true
|
||||||
|
UIView.animate(withDuration: 0.1, animations: { [weak self] in
|
||||||
|
self?.updateView()
|
||||||
|
}) { [weak self] _ in
|
||||||
|
//you update the view since this is typically a quick change
|
||||||
|
self?.updateView()
|
||||||
|
self?.isHighlightAnimating = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open var typograpicalStyle: TypographicalStyle { .defaultStyle }
|
open var typograpicalStyle: TypographicalStyle { .defaultStyle }
|
||||||
|
|
||||||
open var textColor: UIColor { .black }
|
open var textColor: UIColor { .black }
|
||||||
@ -129,7 +143,6 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
// MARK: - PRIVATE
|
// MARK: - PRIVATE
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private func updateLabel() {
|
private func updateLabel() {
|
||||||
|
|
||||||
let font = typograpicalStyle.font
|
let font = typograpicalStyle.font
|
||||||
|
|
||||||
//clear the arrays holding actions
|
//clear the arrays holding actions
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user