A
A
artem-Kolyadin2018-06-05 13:58:53
iOS
artem-Kolyadin, 2018-06-05 13:58:53

Why do UILabel constraints determine the height of the View, and not the pins of the View to other Views?

Please tell me, I can’t deal with Autolayot ​​to implement the following:
1. The first image is placed, 16:9, everything is fine, there are no problems with this
2. Then comes View 1, “pins” to the picture, the edges of the screen, the height changes go several lines), this also works
3. View 3 is also generated well and correctly
PROBLEM:
I would like View 2 to occupy the remaining space between view 1 and view 3. I set the pins with the necessary indents and everything works as long as I add a label to view 2. After I set constraints for the label, the label as a subview starts to stretch or shrink the height of view2 depending on the size of the text. If it shrinks, then view1 begins to stretch. And I would like it, on the contrary, to fit into those view2 sizes that are defined relative to view 1 and view3. And if the text does not fit, I would make a read more button. If there is not enough text, let there be an empty space.
5b166ce2d5d2f782506782.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
doublench21, 2018-06-05
@artem-Kolyadin

  • image [top 0; lead 0; trail 0; height 200]
  • view1[top0; lead 0; trail 0]
  • Label1[ top 8; lead 8; trail8] NumberLines = 0
  • Label2[ top 8; lead 8; trail8] NumberLines = 0
  • label3[top8; lead 8; trail8] NumberLines = 0
  • View1
[Drag ctrl from View 1 to Label3 and select Bottom Space To Container and set to 8]
Get dynamic View1 height depending on Labels
If I understand you correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question