Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • One thing you can do is add a stackView in your cell, then add your text label inside said stackView, just pin everything to the edges and DON'T set the height constraint in neither of the elements, that should auto resize the cell accordingly, also I don't see it in your code, but I assume you are implementing the tableView.rowHeight = UITableViewAutomaticDimension in your didload() right? Commented Jul 17, 2019 at 15:06
  • stackoverflow.com/questions/44766814/… Commented Jul 17, 2019 at 15:08
  • I actually didn't, however, my 3 labels are in a stack view. I apologize for not adding that in the initial question. Also, the Automatic Dimension is not found on my XCode is this something new to swift 5? I'm currently using swift 4. Apologies again long time lurker first time actually answering a question I will edit the question to reflect this. @SamuelChavez Commented Jul 17, 2019 at 15:09
  • @HunterA. no automatic dimension it's not new to swift 5, you should be able to implement it, just change the "tableView" to the actual name of the tableView in your code and that should work, aside from that you just need to check your constraints the, as I said for automatic dimension to work you need to NOT set height constraints on the cells, here is a link that you'll find helpful raywenderlich.com/8549-self-sizing-table-view-cells Commented Jul 17, 2019 at 15:12
  • I've added tableView.estimatedRowheight as well as tableView.rowHeight = UITableView.automaticDimension and removed the Row Heights from the cells in the storyboard. Commented Jul 17, 2019 at 15:13