May Phyu May Phyu - 1 year ago 214
iOS Question

Auto Label Height in swift 3

I would like to adjust the height of label in my app.

enter image description here

I set Number of Lines: 0 in Attribute Inspector. I made Trailing, Leading and Top constraints.

I would like to get label height adjustment. Can anyone help me please?

Answer Source

What you can do is set that label's bottom to the director's name label also set the greater than equal to (>=) constraints for your label height, So it will looks like this.

enter image description here

Now set the constrains for the director's name label to leading, trailing and height with greater than equal to (>=). Now also set the Director heading label top to this director's name label. So you are having constrains for this label like this.

enter image description here

Now simply select the Director heading label and set the fixed width height leading and trailing, Don't forgot to set its top to Director's name label. So the final result give you like this.

enter image description here

Note: Don't forgot to set numberOfLines to 0 for both of your cast name label and director name label.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download