Showing
2 changed files
with
26 additions
and
11 deletions
... | @@ -9,21 +9,31 @@ import UIKit | ... | @@ -9,21 +9,31 @@ import UIKit |
9 | 9 | ||
10 | @IBDesignable | 10 | @IBDesignable |
11 | class CSMButton: UIButton { | 11 | class CSMButton: UIButton { |
12 | + required init?(coder aDecoder: NSCoder) { | ||
13 | + super.init(coder: aDecoder) | ||
14 | + configure() | ||
15 | + } | ||
12 | 16 | ||
13 | - required init() { | 17 | + override init(frame: CGRect = .zero) { |
14 | - super.init(frame: .zero) | 18 | + super.init(frame: frame) |
15 | - self.setup() | 19 | + configure() |
16 | } | 20 | } |
17 | 21 | ||
18 | - required init?(coder aDecoder: NSCoder) { | 22 | + override func prepareForInterfaceBuilder() { |
19 | - super.init(coder: aDecoder) | 23 | + super.prepareForInterfaceBuilder() |
20 | - self.setup() | 24 | + configure() |
21 | } | 25 | } |
26 | +} | ||
27 | + | ||
28 | +private extension CSMButton { | ||
29 | + func configure() { | ||
30 | + setImage(UIImage(named: "directions"), for: .normal) | ||
31 | + titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16) | ||
32 | + setTitleColor(.white, for: .normal) | ||
33 | + backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00) | ||
34 | + layer.cornerRadius = 12.0 | ||
22 | 35 | ||
23 | - private func setup() { | 36 | + imageEdgeInsets = UIEdgeInsets(top:0.0, left:0.0, bottom:0.0, right:5.0); |
24 | - self.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16) | 37 | + titleEdgeInsets = UIEdgeInsets(top:0.0, left:5.0, bottom:0.0, right:0.0); |
25 | - self.setTitleColor(.white, for: .normal) | ||
26 | - self.backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00) | ||
27 | - self.layer.cornerRadius = 12.0 | ||
28 | } | 38 | } |
29 | } | 39 | } | ... | ... |
... | @@ -187,6 +187,11 @@ | ... | @@ -187,6 +187,11 @@ |
187 | <point key="canvasLocation" x="137.68115942028987" y="120.53571428571428"/> | 187 | <point key="canvasLocation" x="137.68115942028987" y="120.53571428571428"/> |
188 | </view> | 188 | </view> |
189 | </objects> | 189 | </objects> |
190 | + <designables> | ||
191 | + <designable name="bw3-J9-wHr"> | ||
192 | + <size key="intrinsicContentSize" width="67" height="31"/> | ||
193 | + </designable> | ||
194 | + </designables> | ||
190 | <resources> | 195 | <resources> |
191 | <systemColor name="systemBackgroundColor"> | 196 | <systemColor name="systemBackgroundColor"> |
192 | <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | 197 | <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ... | ... |
-
Please register or login to post a comment