Reputation: 1623
New to iOS development here - I want to place multiple icons side by side within a view
| A | B | C | D | E | F | G | H |
Based on what I've read, the most flexible way to add constraints would be -
A - Leading, top and bottom constraints of 0 to it's superview + width constraint B - top and bottom alignment with A, leading edge constraint of 0 with A + width constraint C - top and bottom alignment with A, leading edge constraint of 0 with B + width constraint D - top and bottom alignment with A, leading edge constraint of 0 with C + width constraint E - and so on .... . .
This way, if A moves to the right or changes it's vertical alignment, everything else adjusts automatically(I think)
Is this the best way to achieve the above layout?
Upvotes: 0
Views: 46
Reputation: 100533
For your current problem , I recommend using UIStackView
( Horizontal ) with distribution
set to fillEqually
, and if items exceed screen width , embed it inside a UIScrollview
, or use a UICollectionView
instead
Upvotes: 1