Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is there any pod for giving shadow effects to buttons and other control in swift 4.2? Please help me with that! It's been only two weeks I started swift, and two weeks I spent for this!! Someone please help me!!.

What I have tried:

I have tried Material design MDKit! but doesn't worked in swift 4.2.
Posted
Updated 3-Jun-19 5:02am

1 solution

 
Share this answer
 
Comments
Ash_savvy 4-Jun-19 3:09am    
I appreciate your time and effort! Richard!, Thanks a lot!!. It worked for me.
But there is a small issue, which I'm not able to find a solution. I have created a custom class for shadow and assigned that to the appropriate button, shadow and rest everything is works fine, but the button title is not visible. Initially the button fill was white colour, and I change the fill color to my app's theme color (in Custom Class). Even I tried the setTitle property, but. :(
Richard MacCutchan 4-Jun-19 3:56am    
Sorry, but I do not know Swift.
Ash_savvy 4-Jun-19 8:24am    
Not a Problem! I fixed it! thanks a lot! :)
Ash_savvy 4-Jun-19 8:27am    
extension UIButton{

func setShadow(){
layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.7).cgColor
layer.shadowOffset = CGSize(width: 0, height: 3)
layer.shadowOpacity = 1.0
layer.shadowRadius = 10.0
layer.masksToBounds = false
}


this code works! write it in extensions class so that we can call the function with a UIButton ref.
Like MyButton.setshadow()

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900