how to maintain the state of the button image in tableview


I have one table view and each cell has one button after pressing button, button image got change but if I scroll tableview then button image comes in previous state how to avoid this problem.

Store in an Array the state of the button, and when the cell is being loaded, check the state for that cell in the array and set the button properly.