I set an images for button\'s states Normal,Highlighted and Selected, but when the button in selected state and I press/highlight it I didn\'t see my highlighted image but j
In my case, I have to change the UIButton.Type from .custom to .system
.custom
.system
And:
button.setImage(UIImage(named: "unchecked"), for: .normal) button.setImage(UIImage(named: "checked"), for: [.selected, .highlighted])
When handling tapping:
button.isSelected = !button.isSelected