Post

Replies

Boosts

Views

Activity

Reply to AutoLayout pros: TableCell resized depending on inserted UIView?
I like it when I, just by writing the question, answers myself... 😀Of course I have to programmatically add the constraints myself and after reading up on how, it was easily solved.So if there is anyone finding this post in search for something similar, this is how I did it:Constrained the top, left and right sides of the view I was inserting to the top, left and right sides to the contentView of the table cell.Then constrained the bottom of the contentView to the bottom of the inserted view.This makes the view follow the width of the table cell and layout its content regarding this constraints. And the height of the cell is now dependent on the intrinsic size of the inserted view.Just make sure that the inserted view is set to use Autolayout and all the constraints within it adds up.Thanks for listening.
Mar ’20