ios - UICollectionViewCell can't set shadow -


i want set shadow uicollectionviewcell, this:

img

i write code in custom cell

override func awakefromnib() {         super.awakefromnib()         layer.shadowcolor = uicolor(red: 0.7176470757, green: 0.7176470757, blue: 0.7176470757, alpha: 1.0000000000).cgcolor         layer.shadowoffset = cgsizemake(0, 4)         layer.shadowradius = 2        layer.shadowopacity = 1     } 

but can't set cell shadow. subview set shadow:

mycell

how can solve problem?

you should put clipstobounds.that problem.

self.layer.shadowcolor = uicolor(red: 0.7176470757, green: 0.7176470757, blue: 0.7176470757, alpha: 1.0000000000).cgcolor self.layer.shadowoffset = cgsizemake(0, 4) self.layer.shadowopacity = 1.0 self.layer.shadowradius = 2.0 self.clipstobounds = false self.layer.maskstobounds = false 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -