Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able show shadow effect. #12

Open
VDPurohit opened this issue Sep 10, 2019 · 4 comments
Open

Not able show shadow effect. #12

VDPurohit opened this issue Sep 10, 2019 · 4 comments

Comments

@VDPurohit
Copy link

VDPurohit commented Sep 10, 2019

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

@developerawais1
Copy link

I'm unable to change layer properties too.

@Brandon-316
Copy link

Did anyone ever solve this?

@sseifallah
Copy link

sseifallah commented Aug 5, 2020

anyone been able to apply shadow yet ? @perteadrian @perteraul @bcylin

@hisham93
Copy link

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
}

kamrul-cse added a commit to kamrul-cse/CircleBar that referenced this issue Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants