0

I have a label on my storyboard in Xcode 6. I am using Swift. With a function text get's added to the label with a new line, so the label "grows". If I make the label higher the text just vertically aligns in the label, but I want it to align to the top. I did find this answer: https://stackoverflow.com/a/1054681/2976720 but that does not work in Swift.

How can I make this work?

Thank you

Community
  • 1
  • 1
B_s
  • 3,026
  • 5
  • 32
  • 51

1 Answers1

0

I know this is an old question, but that answer does work in Swift with the right syntax (it did for me):

[yourLabelName .sizeToFit()]

and change the number of lines to 0 to dynamically allow for height based on content. This is done after you select the label from your Storyboard and then go to the right pane and select "0" on the "lines" dropdown.

deebs
  • 1,390
  • 10
  • 23