Dimitris Togias

optimize csm button

......@@ -9,21 +9,31 @@ import UIKit
@IBDesignable
class CSMButton: UIButton {
required init() {
super.init(frame: .zero)
self.setup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.setup()
configure()
}
override init(frame: CGRect = .zero) {
super.init(frame: frame)
configure()
}
private func setup() {
self.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
self.setTitleColor(.white, for: .normal)
self.backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00)
self.layer.cornerRadius = 12.0
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
configure()
}
}
private extension CSMButton {
func configure() {
setImage(UIImage(named: "directions"), for: .normal)
titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
setTitleColor(.white, for: .normal)
backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00)
layer.cornerRadius = 12.0
imageEdgeInsets = UIEdgeInsets(top:0.0, left:0.0, bottom:0.0, right:5.0);
titleEdgeInsets = UIEdgeInsets(top:0.0, left:5.0, bottom:0.0, right:0.0);
}
}
......
......@@ -187,6 +187,11 @@
<point key="canvasLocation" x="137.68115942028987" y="120.53571428571428"/>
</view>
</objects>
<designables>
<designable name="bw3-J9-wHr">
<size key="intrinsicContentSize" width="67" height="31"/>
</designable>
</designables>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
......