vaibhav jain
vaibhav jain

Reputation: 89

How to Manage Equal width of Views

I have to design a screen with contain 3 views of equal width.& every view has a remove Button to remove particular view. when i tap on first remove Button than other two views have to equal with along to base View.

How can i manage constraints for this Situation. Please anyone tell me how can i manage.

Thanks

Upvotes: 0

Views: 163

Answers (1)

DonMag
DonMag

Reputation: 77452

Probably the easiest method is to use a UIStackView, with Distribution set to Fill Equally.

When you start, the 3 views will each take 1/3 of the width of the Stack View. On button tap, you can use .removeArrangedSubview() and the Stack View will automatically re-size the remaining two views to each take up 1/2 of the width.

Upvotes: 1

Related Questions