0

I'm trying to adjust my UITableViewCell height according to the amount of space needed, however I can't seem to get it working with my current set up. I'm attempting to use auto layout and have looked at multiple threads and articles.

I've got the two lines of code required for this to work in my viewDidLoad()

tableView.estimatedRowHeight = 80
tableView.rowHeight = UITableViewAutomaticDimension

This is my current setup in my storyboard: enter image description here enter image description here

And it ends up turning out like this:

enter image description here

How would I go about fixing this and getting it working the way I want it to? (I'm most likely stuffing up something very simple with constrains, I'm just very bad with auto-layout and constraints)

Thanks, Max

EDIT

After trying some of @Joe 's suggestion from his answer on this post UITableViewAutomaticDimension Not Working for Resizing Cell Height. I've tried many variants of what he suggested. It partially solves the issue, but messes a few things up. I also attempted reordering the way I added the constraints. It's turning out like this: enter image description here

Community
  • 1
  • 1
Max Kortge
  • 527
  • 7
  • 23
  • Check my answer http://stackoverflow.com/questions/40293336/uitableviewautomaticdimension-not-working-for-resizing-cell-height/40300589#40300589 may help you to resolve your issue. – Joe Oct 31 '16 at 09:39
  • Make sure you auto constraints your profile pic, user name and cell text first. Hop this helps – Joe Oct 31 '16 at 09:42
  • @Joe I've had a look at your answer and used it. It works but it gets other things wrong. I'll post more about it in the main post. – Max Kortge Oct 31 '16 at 10:01

0 Answers0