I wanted to create 6 subviews in a view, which have different width & same height. It should fit horizontal, all screen resolutions for iPad and iPhone.Can anyone please help me on this.
Asked
Active
Viewed 78 times
-1
-
Use a UIStackView. – sdasdadas Feb 01 '17 at 12:57
1 Answers
0
Without any additional logic (i.e., which views to make smaller or not if the content does not fit), you can do this like this: if the views are ligned up from left to right and numbered 1 to 6
- defining the leftmost view (1) with a distance to left edge
- defining the rightmost view (6) with a distance to right edge
- defining the distances between the views (i.e. 1 to 2, 2 to 3 etc.)
- setting the horizontal "compression resistance priority" to differing values
You can set the same height individually, or just for one view and as equal height for the other views.

Mundi
- 79,884
- 17
- 117
- 140
-
Yeah i tried to do this way. But it will ask me for width or x-position for all view. – RashmiG Feb 01 '17 at 11:47
-
You can adjust the horizontal "Content Compression Resistance Priority" so that they are all different. – Mundi Feb 01 '17 at 12:18
-