@@ -32,6 +32,7 @@ public struct KeyboardButtonStyle {
32
32
public var borderWidth : CGFloat
33
33
34
34
// Shadow
35
+ public var shadowEnabled : Bool
35
36
public var shadowColor : UIColor
36
37
public var shadowOpacity : Float
37
38
public var shadowOffset : CGSize
@@ -55,6 +56,7 @@ public struct KeyboardButtonStyle {
55
56
cornerRadius: CGFloat = 5 ,
56
57
borderColor: UIColor = UIColor . clearColor ( ) ,
57
58
borderWidth: CGFloat = 0 ,
59
+ shadowEnabled: Bool = true ,
58
60
shadowColor: UIColor = UIColor . blackColor ( ) ,
59
61
shadowOpacity: Float = 0.4 ,
60
62
shadowOffset: CGSize = CGSize ( width: 0 , height: 1 ) ,
@@ -70,6 +72,7 @@ public struct KeyboardButtonStyle {
70
72
self . cornerRadius = cornerRadius
71
73
self . borderColor = borderColor
72
74
self . borderWidth = borderWidth
75
+ self . shadowEnabled = shadowEnabled
73
76
self . shadowColor = shadowColor
74
77
self . shadowOpacity = shadowOpacity
75
78
self . shadowOffset = shadowOffset
@@ -148,14 +151,18 @@ public class KeyboardButton: UIView {
148
151
private func setupAppearance( ) {
149
152
backgroundColor = style. backgroundColor
150
153
layer. cornerRadius = style. cornerRadius
154
+ // border
151
155
layer. borderColor = style. borderColor. CGColor
152
156
layer. borderWidth = style. borderWidth
153
- layer. shadowColor = style. shadowColor. CGColor
154
- layer. shadowOpacity = style. shadowOpacity
155
- layer. shadowOffset = style. shadowOffset
156
- layer. shadowRadius = style. shadowRadius
157
- if let path = style. shadowPath {
158
- layer. shadowPath = path. CGPath
157
+ // shadow
158
+ if style. shadowEnabled {
159
+ layer. shadowColor = style. shadowColor. CGColor
160
+ layer. shadowOpacity = style. shadowOpacity
161
+ layer. shadowOffset = style. shadowOffset
162
+ layer. shadowRadius = style. shadowRadius
163
+ if let path = style. shadowPath {
164
+ layer. shadowPath = path. CGPath
165
+ }
159
166
}
160
167
}
161
168
@@ -183,12 +190,12 @@ public class KeyboardButton: UIView {
183
190
// MARK: Popup
184
191
private func showPopup( show show: Bool ) {
185
192
if show {
186
- if viewWithTag ( 1 ) != nil { return }
193
+ if viewWithTag ( 101 ) != nil { return }
187
194
let popup = createPopup ( )
188
- popup. tag = 1
195
+ popup. tag = 101
189
196
addSubview ( popup)
190
197
} else {
191
- if let popup = viewWithTag ( 1 ) {
198
+ if let popup = viewWithTag ( 101 ) {
192
199
popup. removeFromSuperview ( )
193
200
}
194
201
}
0 commit comments