I have many different types of images being uploaded with different sizes. I just need to display them on a detail viewcontroller page with the full width and then adjust the height accordingly to keep the ratio. So the height can be any size, just the width gets adjusted.
I've tried aspect fit but it creates white space on the top and bottom. Is there any other way to just diplay and image having it shrink down with the same ratio and not add spacing? That seems like the standard way with anyting on the web.
Thanks for any help.
Um, no, you're setting a constraint on the view's height vs. width:
let image = …
let constraint = NSLayoutConstraint(
item: view, attribute: NSLayoutAttribute.Height,
relatedBy: NSLayoutRelation.Equal,
toItem: view, attribute: NSLayoutAttribute.Width,
multiplier: image.size.height / image.size.width, constant: 0.0)
or something like that.