Sanoj Kashyap
Sanoj Kashyap

Reputation: 5060

How to achieve this view using UIStackview?

I want to use UIStackview, for making the below UI. The Problem I am facing to give un even space while using UIStackViews.

enter image description here

Upvotes: 0

Views: 89

Answers (2)

Irfan
Irfan

Reputation: 5130

Almost everything is possible through stackview in a feasible way. If you want uneven size or spaces - one can set the distribution fill-proportional or alignment to center and apply single constraint - for space, for height or width.

The point is that using stackview we do things with least number of constraints.

The below UI has 11 constraints of which 4 are used for stackview position and size.

My results are: For most Design, while using stackview we don't need to apply constraint for internal elements. But for some case like this we can still use stackview and get the benifits by using very minimum amount of contraints. We still have all the power of autolayout while using stackview.

enter image description here

Upvotes: 1

cnbecom
cnbecom

Reputation: 166

Is there a reason you are not pinning the elements to each other and their parent view? UIStackView would not be my first option in this case.

Upvotes: 0

Related Questions