Swift: Change the cell's UIButton Image With tableView DidSelect method

前端 未结 3 1654
有刺的猬
有刺的猬 2020-12-07 00:26

I Have TableView with the two label and one UIButton inside the Tableview. So on DidSelect method i want to change the UIButton<

3条回答
  •  隐瞒了意图╮
    2020-12-07 00:40

    you need to first set button tag in cellForRow method

    after in didSelectRowAtIndexPath method you need to set image of button and in didDeselectRowAtIndexPath set unselect image in button.

    you can set button image by using :

    playButton.setImage(UIImage(named: "play.png"), forState:UIControlState.Normal)
    

提交回复
热议问题