ios - Changing a single UIButton image in a collection view is affecting multiple cells -


i using collection view display list of events user, , each 1 of custom cells has button invites user attend event. when pressed, button image should change newimage.png displays attending event. when in code below, pressing button in fact change picture, scroll down collection view, multiple cells have yet clicked have changed "newimage.png." how can stop happening?

class customcell: uicollectionviewcell{   @ibaction func mybuttonaction(sender: uibutton) {         mybuttonoutlet.setimage(uiimage(named: "newimage.png"), forstate: uicontrolstate.normal)     }   @iboutlet weak var mybuttonoutlet: uibutton! } 

the collection view reusing cells, designed do. should reset image in cellforitematindexpath implementation.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -