3

I have 2 labels that are stacked and have a bottom space constraint to their common container. I want to hide the lower label if there's no value for it and move the upper label down to the lower label's position. I can do that easily with an outlet bound to the bottom space constraint for the upper label.

enter image description here

The problem here is that these labels have different font sizes. So, when I set the same value for the bottom space constraint for the upper label, like I have set for the lower one, the upper label does not end up at the same vertical position.

enter image description here

I assume this is because these labels have different descenders, due to different fontsizes. It would be easy to solve that if I could set the bottom space constraint not for the frame of the text, but its base line. I'd like to do this in IB, if possible.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181

0 Answers0