We’re are downloading images from the Internet and assigning them to an UIImageView object with aspectFit as it’s contentMode, something like [myImageView setImageWithURL:aURL].

However, aspect fit will resize the image and center it within the boundaries of the view. In other words when the image’s width is more than it’s height, then, there will be an space in between the bottom border of the UIImageView and the image itself.

Now, I want to include a label below the image without any type of space in between. How can this be achieved? I mean, we could resize the image beforehand and set the ImageView frame afterwards, but, since the image’s source is a URL this would required downloading the image first (A bunch of code that is already implemented by UIImageView categories).

Is there a way to tell UIImageView to “wrap” itself around the resizedImage, or is there a way to achieve this effect through constraints?