• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How to dynamically resize UILabel in a UITableView Cell?

Resolved: How to dynamically resize UILabel in a UITableView Cell?

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

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

enter image description here

Answer:

If you have better answer, please add a comment about this, thank you!

ios swift uilabel
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to make statement case insensitive when uploading a dta file with specified columns?

27/03/2023

Resolved: Sort dataframe columns value by close it to another column

27/03/2023

Resolved: PostgreSQL resample 1 minute OHLCV candle data into 5 minute OHLCV candle data

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.