Created
August 8, 2016 18:45
-
-
Save jeffaburt/be6575335cf3b97fc06bb55c125d89f4 to your computer and use it in GitHub Desktop.
Revisions
-
jeffaburt created this gist
Aug 8, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ import UIKit class FadeWhenHiglightedButton: UIButton { private var initialAlpha: CGFloat! override var highlighted: Bool { didSet { alpha = highlighted ? initialAlpha - 0.4 : initialAlpha } } override init(frame: CGRect) { super.init(frame: frame) commonInit() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) commonInit() } private func commonInit() { initialAlpha = alpha showsTouchWhenHighlighted = false adjustsImageWhenHighlighted = false reversesTitleShadowWhenHighlighted = false } }