Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Resize UIImageView in Swift

I am trying to make a UIImageView frame (just a solid colour needed, I have tried with a solid colour image and no image with a background colour) change its height programatically using swift. I have placed the UIIMageView in using interface builder in Xcode 6. I have set several constrains on it using auto layout. I have tried leaving the height constraint blank, as well as having it set to a specific value.

Basically I just need the UIImageView to grow in height, but all other values stay the same.

Ratio and height are CGFloats calculated above, and I have debugged and checked that they calculate correctly. It is just that the height is not updating. The name of the UIMageView is blankScroller

var newHeight: CGFloat = ratio*height;
blankScroller.frame = CGRectMake(
    blankScroller.frame.origin.x,
    blankScroller.frame.origin.y,
    blankScroller.frame.size.width,
    newHeight); 

have also tried:

blankScroller.frame.size.height = newHeight;

Yet none of these seem to work, the UIImageView stays a constant size. Thanks for any help!