I added button into cell-s and added action so if user touches it then the state is \"Dislike\" and if user touches again the state is \"Like\". However, the state applies t
This is caused by reusing previous cells when scrolling and is the base mechanism of a table view.
You need to reset the state of your button on every call to cellForRowAtIndexPath
.
Between let cell = ...
and cell.starButton.addTarget
you need to perform something like cell.starButton.deselect()
, or .select()
, based on the index path you're working on.