ios - Custom UICollectionViewFlowLayout animation -
i've got custom uicollectionviewflowlayout animation staggers views in right insertions , out left deletions. setting cabasicanimation on uicollectionviewlayoutattributes , applying cell layer.
collectionviewanimations project on github
the default alpha 0 , fading out cells , ending custom animation early. if change alpha 1 don't see animation @ all. set @ 0.5 , bit of both.... it's weird. you'd have run project see mean.
for reason, can't seem remove default alpha on attributes in finallayoutattributesfordisappearingitematindexpath.
anyone got ideas?
you're using performbatchupdates(_:completion:)
animates changes set in finallayoutattributesfordisappearingitematindexpath(_:)
, if add cabasicanimation
you're adding animation animation that's gonna happen. if drop animation celllayoutattributes
, set transform3d
of uicollectionviewlayoutattributes
it's gonna want (except animation begintime
, fillmode
). piece of code works me:
override func finallayoutattributesfordisappearingitematindexpath(itemindexpath: nsindexpath) -> uicollectionviewlayoutattributes? { let attributes: celllayoutattributes = super.finallayoutattributesfordisappearingitematindexpath(itemindexpath) as! celllayoutattributes // default 0, if set 1.0 don't see happen..' attributes.alpha = 1 let endx = -cgrectgetwidth(self.collectionview!.frame) var endtransform: catransform3d = catransform3dmaketranslation(endx, 0, 0) attributes.transform3d = endtransform return attributes }
Comments
Post a Comment