How to style a button using teacup

136 Views Asked by At

I'm using teacup to style my button. I'd like the text to wrap and the button to be a circle - so i want to set the button to rounded corners, set the radius etc.

How can i do this with teacup?

Here is how i'm defining my button:

add button = UIButton.new,
  stylename: :my_button,            # Teacup
  resize: [ :left, :right, :top ], # ProMotion
  frame: CGRectMake(25, 250, 90, 90)

and then in my styles:

style :my_button,
    backgroundColor: UIColor.grayColor,
    title: 'Tailored Wisdom Now!',
    alpha: 0.5,
    numberOfLines: 0,
    line_break_mode: UILineBreakModeWordWrap,

The button displays as a square with cropped text.

1

There are 1 best solutions below

0
On

You would probably go into the layer to do that in Teacup. So maybe something like this:

style :my_button,
  backgroundColor: UIColor.grayColor,
  title: 'Tailored Wisdom Now!',
  alpha: 0.5,
  numberOfLines: 0,
  line_break_mode: UILineBreakModeWordWrap,
  layer: {
    cornerRadius: 5
  }

Does that work?