I have a View like shown in the image. Leading and trailing distance is increasing when showing view on different screens. How do I make it look good on every screen by using constraints.
Asked
Active
Viewed 73 times
-3
-
what do you mean by "look good"? – Agent Smith Mar 07 '18 at 07:25
-
2Use horizontal `Stack View` – pkc456 Mar 07 '18 at 07:25
-
best way is use StackView >> distribution = fill equally – Uday Babariya Mar 07 '18 at 07:25
-
All images height and width increase or decrease equally @Agent Smith – bhupinder Mar 07 '18 at 07:44
-
It is recommended to add your tried code or any efforts you have made till now – Prashant Tukadiya Mar 07 '18 at 07:51
2 Answers
2
You can use UIStackView
(Horizontal) with distribution Equally , here is a run on iPhone
Also with iPad

Shehata Gamal
- 98,760
- 8
- 65
- 87
-
-
Is it possible to adjust height of stackview correspond to width of single item in the stackView? – bhupinder Mar 07 '18 at 08:50
0
Add the following constraints
- Assign equal width from image1 to image2.
- Assign horizontal spacing between both image.
- Assign leading space from image1 to its superview.
- Assign trailing space from image2 to its superview.
- Assign top space to both the buttons.
Then do this same steps for image3 and image4

Rashed
- 2,349
- 11
- 26