ios - Update shadow layer when orientation changing -


i have uicollectionview shadow on cells. use

notificationcenter.default.addobserver(self, selector: #selector(self.rotate), name: .uideviceorientationdidchange, object: nil) func rotate() {     setneedslayout()     layoutifneeded() } 

and in layoutsubviews() reload shadow. in cells, appearing on screen good, in cells, far too, cells, existed, out of screen (right or down) not updated.

why it, , how can resolve problem?

here update shadow code:

circleshadowview.layer.shadowpath = uibezierpath(roundedrect: circleshadowview.bounds, cornerradius: circleshadowview.bounds.width / 2).cgpath circleshadowview.layer.shouldrasterize = true circleshadowview.layer.rasterizationscale = uiscreen.main.scale  let masklayer = cashapelayer() let path = cgmutablepath() path.addrect(circleshadowview.bounds.insetby(dx: 0, dy: -30)) path.addroundedrect(in: circleshadowview.bounds, cornerwidth: circleshadowview.bounds.width / 2, cornerheight: circleshadowview.bounds.width / 2) masklayer.path = path masklayer.fillcolor = uicolor.black.cgcolor masklayer.fillrule = kcafillruleevenodd  circleshadowview.layer.mask = masklayer 


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -