Skip to content

Having a different border color than the text color #8

@jyounus

Description

@jyounus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions