I tried multiple solutions from stack overflow but no luck. I have set HighlightedAdjustsImage = false
In my Code :
button.backgroundColor = .clear
button.layer.borderWidth = 0
inside my IBAction
for button I am changing image and also setting value of isSelected as :
button.isSelected = !button.isSelected
what did i do wrong here?
3
Answers
Try this
To disable the highlighting effect of a
UIButton
when it is clicked, you can set itsshowsTouchWhenHighlighted
property to false. Here’s how you can do it:To disable the highlighting effect of a UIButton ,
please add the below extension in your code:
after that go to the interface builder and change the button class UIButton to NoHighlightButton. Your issue will be resolved.
The problem is the Style setting of your button in the storyboard (the second popup menu in your screenshot).
Change the Style from Plain to Default and the button will start working according to your specification.