I want an imageview which has fixed width but variable height. I want to refresh view if the image that I get from the website is heighter than the imageview in storyboard,
This is the view when I use "Scale to Fill".
postimg.org/image/6l1ol2pvz
And this is when I use "Aspect Fill"
postimg.org/image/9duw53q8f/
I want the image to be like in "Aspect Fill" but I can't place the bottom correctly.
Thank you all!
Solution:
I gave my image width and height constraints. Then I changed it programmatically. This is the view I wanted and I made it work!
https://i.sstatic.net/PCgHw.png
let imageData = NSData(contentsOfURL: imgUrl)
let myImage = UIImage(data: imageData!)
let aspectRatio = (myImage?.size.height)! / (myImage?.size.width)!
self.postCombineImageViewHeight.constant = UIScreen.mainScreen().bounds.size.width * aspectRatio
self.postCombineImageViewWidth.constant = UIScreen.mainScreen().bounds.size.width
Thank you all for your help!


