-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDesignButton.swift
More file actions
51 lines (40 loc) · 1.25 KB
/
DesignButton.swift
File metadata and controls
51 lines (40 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// DesignButton.swift
// DesignButton
//
// Created by Adrian Viquez on 2017-08-03.
// Copyright © 2017 Adrian Viquez. All rights reserved.
//
//Xcode Source Control Commit Test 1.0
import UIKit
//Custom Class for Button, which derives from UIButton (now, inheriting from BounceButton)
@IBDesignable class UICustomButton: BounceButton {
//PURPOSE: allows to modify the border width
@IBInspectable var borderWidth : CGFloat = 0.0 {
didSet {
self.layer.borderWidth = borderWidth
setNeedsDisplay()
}
}
//PURPOSE: allows to modify the border color (clear is default)
@IBInspectable var borderColor : UIColor = UIColor.black {
didSet {
self.layer.borderColor = borderColor.cgColor
self.setNeedsDisplay()
}
}
//PURPOSE: allows to modify the fontColor
@IBInspectable var fontColor: UIColor = UIColor.clear {
didSet {
self.tintColor = fontColor
setNeedsDisplay()
}
}
//PURPOSE: allows to modify the corner radius
@IBInspectable var cornerRadius: CGFloat = 0.0 {
didSet {
self.layer.cornerRadius = cornerRadius
setNeedsDisplay()
}
}
}