I have a few labels, which should never be touching each other. See the image below (ignore the yellow letters):
These are 4 labels in total, 2 player names and 2 scores. The name of the player will replace the original player label text. So "player 1:" could be any text, in any width. The labels are in a View, in a UIStackView. Each 2 labels (so players name and score) has his own View. In this example, there are 4 labels, in 2 Views, in 1 UIStackView. This is what I want:
The score labels will never auto shrink, they keep always there original height and would auto increase in width if the content(score) will grow. Therefore, I have set the content hugging priority to larger values than the player name label. Since I do not want the score label to auto shrink, I set the content compression resistance priority to a larger value than that of the players name label.
I set the players name label text to a auto shrink value scale to 0.5. Yet, when a large username is presented, it appears over the score label like this (I made the original blue "0" now yellow):
The username should auto shrink, and should never touch the score label. How can I do this?
I hope you can help!
Edit: I want to add a trailing space between to players name and players score label. To do this, I want to add a trailing space from players name, to players score label. However when adding this constrain it will also take the entire score label. I want it of course to stop when it touches the score label. Pic 1 showing here the size of players name when added the trailing space to the score label. It takes up the score label swell. :
I do not want to use fixed constrains as that would cause problems running it on a iPad or iPhone SE. Thank you.