Add a highlight background color
Adds an IBInspectable background color for the hightlight state.
This commit is contained in:
parent
47ca7a8a30
commit
25411ead45
|
@ -10,6 +10,8 @@ import UIKit
|
||||||
|
|
||||||
class VibrantButton: UIButton {
|
class VibrantButton: UIButton {
|
||||||
|
|
||||||
|
@IBInspectable var backgroundHighlightColor: UIColor = AppAssets.secondaryAccentColor
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
commonInit()
|
commonInit()
|
||||||
|
@ -25,7 +27,7 @@ class VibrantButton: UIButton {
|
||||||
|
|
||||||
override var isHighlighted: Bool {
|
override var isHighlighted: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
backgroundColor = isHighlighted ? AppAssets.secondaryAccentColor : nil
|
backgroundColor = isHighlighted ? backgroundHighlightColor : nil
|
||||||
titleLabel?.alpha = 1
|
titleLabel?.alpha = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue