ios - Animate the changing of data in a collectionView -
i'd animate change in uicollectionview. have collectionview @iboutlet
:
@iboutlet weak var collectionview: uicollectionview!
and collection view reloads (so can change alpha of each cell) this:
var bulkawardmode = false; @ibaction func bulkawardtoggleclicked(sender: uibutton) { if(bulkawardmode == false) { bulkawardmode = true } else { bulkawardmode = false } dispatch_async(dispatch_get_main_queue(), { self.collectionview.reloaddata() }) }
however not animated, tried changing reloaddata()
line self.collectionview.reloadsections(nsindexset(index: 0))
, causes crash error attempt create view animation nil view
.
i'm doing wrong, i'm not quite sure what. did try putting code in uiview.animatewithduration
block, failed.
you can try:
collectionview.performbatchupdates({ () -> void in // here can insert ,delete , animate cells }) { (success) -> void in //completion block }
Comments
Post a Comment