Say I have two labels, one on top of the other. Label 1
is set to have a maximum number of lines of 2 (numberOfLines=2
). So sometimes, depending on the text, Label 1
can take up TWO lines. The thing though is that a maximum of 2 lines should be shown between both labels, where Label 1
's second line takes precedence over Label 2
. (Also, Label 2
is always 1 line.)
So either of these 2 scenarios are possible:
Label 1 text
Label 2 text
OR
Label 1 text (line 1)
Label 1 text (line 2)
The only way I thought to attack this was to simply hide Label 2
if Label 1
is taking up 2 lines. But the problem is, how can I determine how many lines Label 1
is taking up?
I've found a few other answers about this (1, 2), but none seem to work for me. Is there perhaps a better way to go about this?