skip to Main Content

I was trying to implement a radio button view in Storyboard. I used UIStackView, UIButton and UILabel. With these I was able to design the view but there were some issues. The page I have designed is shown below:

enter image description here

And the Storyboard styling is given below:

enter image description here

How to fix the height issue for the Radio Button for the second option.

2

Answers


  1. The inner stack views should have an alignment of "Center".

    With an alignment of "Fill" as you do right now, the contents of the horizontal stack view will try to fill the entire height of the stack view. Since there are multiple lines of text in the label, the stack view is forced to have a larger height. Because of the "Fill" alignment, the circles undesirably try to expand vertically.

    With an alignment of "Center", the contents of the stack view will not expand. Their heights will be determined by the constraints you added, or by their intrinsic height. And their Y positions will be determined by the centre of the stack view.

    Login or Signup to reply.
  2. You can change UIStackView attributes like this:
    first

    and important you should change UIStackView trailing constraint like this:
    second

    and it’s done.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search