1

Trying to get my messages in the tableView to have automatic height in each row but currently the long label texts are cut. Any help appreciated!

This function is called from viewDidLoad() and it is called for each row(tested with print): enter image description here

All constraints are set in the storyboard: enter image description here

Lines are set to 0: enter image description here

Constraints for label: enter image description here

Resulting in no dynamic height but cutting the message instead: enter image description here

olle
  • 134
  • 3
  • 15
  • I personally suggest you that if you want performance then calculate cell height manually https://stackoverflow.com/questions/30450434/figure-out-size-of-uilabel-based-on-string-in-swift – SPatel Nov 03 '18 at 04:17
  • set label's content hugging priority to law value – SPatel Nov 03 '18 at 04:22
  • and also set labels height constraints.constant to grater or equal to height of image view – SPatel Nov 03 '18 at 04:23
  • 1
    I would remove the height constraint on the label and increase its content compression resistance priority. – Mike Taverne Nov 03 '18 at 06:13

1 Answers1

0

I think your issue might be because your label is set in a UIView. What is your UIView constraint? Your UIView shouldn't have a height anchor for sure and maybe you could try setting it to the same height as your label. (Best guess)

Li Sim
  • 216
  • 1
  • 6