SWFrameButton icon indicating copy to clipboard operation
SWFrameButton copied to clipboard

Having a different border color than the text color

Open jyounus opened this issue 9 years ago • 0 comments

Hey there,

Is there a way to set the border color to be a different color than the text color itself?

I basically want to have a button with lets say a red background color (note: background color, not tint color. So even if the user doesn't press the button, it's red). The text would be white in this unhighlighted state.

Now lets say the user taps on the button, I want to change the filled background color to white, the text to be red and the border to be red.

Is that possible, if so how can I achieve this effect?

I'm currently using this code but it's not really giving me what I'm after:

rightButton.setTitle("Say Hi!", forState: UIControlState.Normal)
rightButton.tintColor = UIColor.whiteColor()
rightButton.backgroundColor = UIColor.redColor()
rightButton.cornerRadius = 25 // button height is 50
rightButton.borderWidth = 1

Everything works, except that I still want the border color to be red instead of white when the user taps on it.

jyounus avatar May 24 '16 10:05 jyounus