ios - I can't animate UICollectionViewCell subclass or any of it's subviews -


i have animation function use in many other parts of app , works perfectly:

class func pulse(view: uiview, sizemultiplier: float, duration: nstimeinterval, repeatcount: float = 1.0) {     let pulseanimation = cabasicanimation(keypath: "transform.scale")     pulseanimation.duration = duration     pulseanimation.tovalue = nsnumber(float: sizemultiplier)     pulseanimation.timingfunction = camediatimingfunction(name: kcamediatimingfunctioneaseineaseout)     pulseanimation.autoreverses = true     pulseanimation.repeatcount = repeatcount     view.layer.addanimation(pulseanimation, forkey: nil) } 

for reason though, can't animate cell in uicollectionview

in didselectitematindexpath function (which being called, checked breakpoints), have this:

let cell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) as! modulecell         animations.pulse(cell, sizemultiplier: 2.0, duration: 0.2, repeatcount: 2) 

any ideas?

change code to

let cell = collectionview.cellforitematindexpath(indexpath) 

you create / dequeue new cell rather retrieving current cell.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -