I have two UILabel
s: name and description. The constraints are setup as the following:
When I run the program, not consistently, sometimes name is truncated and sometimes description is truncated.
The proper way to address this is to change the Content Hugging Priority for one of the labels. By default, this is set to 251. Just change one of the label's Content Hugging Priority to 250 or 252 depending on how you want it to be "hugged".
In code:
func setContentHuggingPriority(_ priority: UILayoutPriority,
for axis: NSLayoutConstraint.Axis)
Or interface builder:
And check out this post if you need more info about this topic: https://medium.com/@abhimuralidharan/ios-content-hugging-and-content-compression-resistance-priorities-476fb5828ef