I am using setNumberOfLines and sizeToFit to resize my label in tableView cells dynamically. When there are more than 2 lines, my label will stretch to upside, but I want to make it stretch down.
let's say I have label1 and label2. their y position is the same before setting label.text:
label1 label2
--------- ---------
| | | |
--------- ---------
label1 has only one line while label2 has two lines after setting label.text separately. it looks like this now:
label1 label2
---------
--------- | line1 |
| line1 | | line2 |
--------- ---------
however, what I want is:
label1 label2
--------- ---------
| line1 | | line1 |
--------- | line2 |
---------
I believe there is a simple way to achieve my goal, but I can't find it by googling with the keyword I can think up.
my code:
myLabel.text = value;
[myLabel setNumberOfLines:0];
[myLabel sizeToFit];
