ios - UICollectionViewCell can't set shadow -
i want set shadow uicollectionviewcell
, this:
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:
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
Post a Comment