Button state activates on wrong cells

前端 未结 3 394
一生所求
一生所求 2021-01-16 04:47

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

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-16 05:16

    I think this issue is because of dequeuing your cell twice. you should try;

    func like(sender: UIButton){
        //your code ...
        let cell: FeedTableViewCell = self.tableViewAddress.cellForRowAtIndexPath(indexPath) as! FeedTableViewCell
        //Your code ...
    

提交回复
热议问题