Change color of text when button is pushed?
There is no property setter color
in UIButton
. use instead setTitleColor
.Write this in viewWillAppear
colorsBtn.setTitleColor(UIColor.brownColor(), forState: UIControlState.Normal)
This will change title color to brown for UIControlState.Normal
To set the color of title
when button is in Highlighted
state use
colorsBtn.setTitleColor(UIColor.brownColor(), forState: UIControlState.Highlighted)