I am trying to create a single table view cell that displays an image, downloaded from the web, and scaled down to fit the width of the device. Part of the problem is that I need to figure out how to resize the cell after the image is downloaded. In other words, I will set a default height while the image is loading, then once the image has loaded, I want to resize the height of the cell. I know that I can set the content mode of the image view to "aspect fit" once I specify a fixed width and height, but I'm not sure how to set the constraints programmatically so that the height can remain flexible.
How can I define these constraints in code?