CircleBar
CircleBar copied to clipboard
Not able show shadow effect.
Shadow effect not showing.I added shadow radius and shadow color viewwillAppear of SHCircleBarController using below code.
tabBar.layer.shadowOffset = CGSize(width: 0, height: 0)
tabBar.layer.shadowRadius = 2
tabBar.layer.shadowColor = UIColor.black.cgColor
tabBar.layer.shadowOpacity = 0.3
(https://stackoverflow.com/questions/37338288/ios-getting-desired-shadow-above-uitabbar) but not working.
Please help me to add shadow in tabbar.
Thanks, Vivek
I'm unable to change layer properties too.
Did anyone ever solve this?
anyone been able to apply shadow yet ? @perteadrian @perteraul @bcylin
Add the following lines under draw() function in SHCircleBar class: override func draw(_ rect: CGRect) { ....
let shadowSubLayer = createShadowLayer()
shadowSubLayer.accessibilityHint = "shadow"
shadowSubLayer.insertSublayer(mask, at: 0)
self.layer.sublayers?.filter({$0.accessibilityHint == "shadow"}).forEach({$0.removeFromSuperlayer()})
self.layer.insertSublayer(shadowSubLayer, at: 0)
self.backgroundColor = .clear
}
use the following function to create shadow: func createShadowLayer() -> CALayer { let shadowLayer = CALayer() shadowLayer.shadowColor = UIColor.black.cgColor shadowLayer.shadowOffset = CGSize.zero shadowLayer.shadowRadius = 2.0 shadowLayer.shadowOpacity = 0.2 shadowLayer.backgroundColor = UIColor.clear.cgColor return shadowLayer }