Search code examples
swiftautolayoutuistackview

UIStackView Weight like Linear layout


How to design the following layout with StackView

enter image description here

I know that it can be easily created without using stackview but is it possible using stackview because i have lots of ui which already designed using stackview how can i add divider between views like above image

For that i set the following constraints

enter image description here

**But run time it shows like ** enter image description here


Solution

  • You can use some simple Autolayout constraints to get this kind of interface with a UIStackView.

    The below image describe the hierarchy and constraints that you can apply:

    enter image description here

    Also the Accept and Reject buttons have Equal Width constraint.

    Output screenshot:

    enter image description here