ios - Display button on UICollectionViewCell after UILongPressGestureRecognizer -
i have uilongpressgesturerecognizer on cell collectionview , want display button (and others) cells after long touch happens. here's code:
func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let cell: cellcontroller = collection.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) as! cellcontroller cell.exitbutton.hidden = true return cell }
i want set false cell.exitbutton.hidden
after touch happen.
thanks in advance
have bool variable in collectionview's class scope. when detect long press, modify bool variable. in example, i'll declare var exitbuttonhidden = true
.
change implementation of cellforitematindexpath
, such modifies cell.exitbutton.hidden = true
cell.exitbutton.hidden = exitbuttonhidden
.
now, need call reloaddata
on collectionview whenever detect long press collectionview gets chance refresh cells again.
Comments
Post a Comment