Skip to content

Commit 1e7eb3a

Browse files
committed
- shadow issue fixed
1 parent cf93d05 commit 1e7eb3a

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

SSCustomTabBar/Classes/SSCustomTabBar.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@ public class SSCustomTabBar: UITabBar {
4343
}
4444
}
4545

46+
/// Shadow Color
47+
@IBInspectable var shadowColor: UIColor {
48+
get {
49+
return UIColor(cgColor: self.layer.shadowColor ?? UIColor.clear.cgColor)
50+
}
51+
set{
52+
self.layer.shadowColor = newValue.cgColor
53+
}
54+
}
55+
56+
/// Shadow Radius
57+
@IBInspectable var shadowRadius: CGFloat {
58+
get {
59+
return layer.shadowRadius
60+
}
61+
set{
62+
self.layer.shadowRadius = newValue
63+
}
64+
}
65+
66+
/// Shadow Offset
67+
@IBInspectable var shadowOffset: CGSize {
68+
get {
69+
return layer.shadowOffset
70+
} set {
71+
self.layer.shadowOffset = newValue
72+
}
73+
}
74+
4675
private var kLayerFillColor: CGColor = UIColor.blue.cgColor
4776
private var displayLink: CADisplayLink!
4877
private let tabBarShapeLayer = CAShapeLayer()
@@ -129,6 +158,12 @@ extension SSCustomTabBar {
129158
self.shadowImage = UIImage()
130159
self.clipsToBounds = false
131160

161+
/// Shadow
162+
self.layer.shadowOffset = shadowOffset
163+
self.layer.shadowRadius = shadowRadius
164+
self.layer.shadowColor = shadowColor.cgColor
165+
self.layer.shadowOpacity = 1.0
166+
132167
self.addSubview(leftPoint4)
133168
self.addSubview(leftPoint3)
134169
self.addSubview(leftPoint2)

SSCustomTabBar/Classes/SSCustomTabBarViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class SSCustomTabBarViewController: UITabBarController {
6060
self.setObserver()
6161
}
6262
}
63+
self.applicationDidBecomeActive()
6364
}
6465

6566

0 commit comments

Comments
 (0)