Add a highlight background color

Adds an IBInspectable background color for the hightlight state.
This commit is contained in:
Jonathan Bennett 2019-10-28 00:51:13 -04:00
parent 47ca7a8a30
commit 25411ead45
1 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,8 @@
import UIKit 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)
@ -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
} }
} }