How to prevent uibutton albut from zero to zero when pressing the Swift button?

UIbutton's alpha vanishes and becomes transparent when clicked. Ive added this IBAction

@IBAction func btnTapped(sender: UIButton) {
    sender.highlighted = false
    //...
}

and UIButton is still transparent when touched. How to prevent this?

+4
source share
2 answers

I struggled with this problem and finally fixed it by changing the button type from System to Custom.

+12
source

You tried something like:

yourButtonClass.setTitleColor(UIColor.blackColor(), forState: .Highlighted)
+1
source

All Articles