Search code examples
iosswiftxcode6uilabelautosize

UILabel Autoshrink Mal-use?


I Need a label in my UI to hold up to 32 characters without distorting, so I enabled auto shrink and changed the number of lines to 0:

enter image description here

heres my label on the IB:

enter image description here

now when I run the application it runs off the screen:

enter image description here

how can I make it fit accordingly?


Solution

  • enter image description hereremove constraints first

    • give the width 0 and apply width constraints . Click on the constraints change width constraint = to >= after which side you want (left or right) apply top space and (trailing space or leading space) apply two constraints.
    • clear the lable text.
    • try it and let me know after this wat is th problem.