I am going to work on a project that will use a lot of checkboxes. I found a solution like below, but I know this not right way.
@IBAction func btn_box(sender:
Please try this.
btn.setImage(UIImage(named: "uncheckImage"), for: UIControlState.normal) btn.setImage(UIImage(named: "checkImage"), for: UIControlState.selected) @IBAction func btn_box(sender: UIButton) { if btn.isSelected == true { btn.isSelected = false } else { btn.isSelected = true } }