I have a view divided in 5 pieces with 4 lines (which are views too with a height of 1). I am making my swift app responsive with different apple devices sizes but the problem is that the y position of the small views is not changing with the device size and it's making the interface ugly . The question is how make the y position of each small view take a value of 1/5 of the big view. Note that I am new to multipliers and advanced constraints. I hope i've made my question clear and thanks in advance. Edit: picture 1 picture2 Sorry I can't upload picture due to reputation but here are two links to the pictures
Asked
Active
Viewed 140 times
-2
-
Can you provide some screenshot of simulator and/or storyboard so your problem would be more clear? – Yury Imashev Sep 16 '18 at 21:17
-
Please see post edit – Bettaieb Amine Sep 16 '18 at 21:25
-
Unclear how the question relates to the pictures. Which are the "small views" and the "big view"? – matt Sep 16 '18 at 21:29
-
So, the problem is that there is some blank space under the last view. What would you like to get? For example, all views might have the same height or space between them can make then fill the screen. – Yury Imashev Sep 16 '18 at 21:30
-
@YuryImashev that's what i am trying to get , I want those labels (Anniversaire, Adresse, Profession , status and Enfants) to have the same height and occupy the hole view , which in my picture is not the case for the ipad – Bettaieb Amine Sep 16 '18 at 21:34
3 Answers
0
It sounds like you are a describing a stack view (UIStackView) with five arranged views in Fill Equally mode. It will cause each of the five subviews to occupy 1/5 of its own height.

matt
- 515,959
- 87
- 875
- 1,141
0
I'm not sure how exactly you set up your "small" views, but I'd recommend you to use UIStackView
to achieve the desired effect. Here you can read more about it.
- Using the
Interface Builder
addVertical Stack View
to your view controller. - Place your "small" views in it.
- Using the
Interface Builder
, setDistribution
parameter toFill Equally
.
After this, UIStackView
will keep you small views height equal and the fill its height.

Yury Imashev
- 2,068
- 1
- 18
- 32
0
I set this up using a UIStackView
containing 5 views and 4 views to serve as the lines.
Here is the setup for the stack view:
Here is the setup of the view hierarchy and constraints:
Notes:
- The lines have constraints which set their height to 1 point.
- Views 2 through 5 have their heights set equal to View 1's height.
- The size of the stack view is constrained to the safe area.

vacawama
- 150,663
- 30
- 266
- 294