Question:I defined a CustomCell type in my UITableView (shown below), which contains two labels in a stackView. The second label in the stackView has its numberOfLines set to 2. However, when this line has 1 line of data, it causes the second label to be cut off vertically (shown below).
How can I update the constraints so that the second label can dynamically adjust based on if there are 1 or 2 lines of data?
What I tried:
- Setting the stackView’s distribution to fillProportionally, this only works if there are 2 lines of data in the second label
- Adding spacing to the stackView to separate the two labels
- Removing the stackView, and constraining the two labels individually
If you have better answer, please add a comment about this, thank you!