Lucas Azzopardi Lucas Azzopardi - 9 months ago 51
Swift Question

Programmatically change the height and width of a UIImageView Xcode Swift

Hey for some reason I am struggling with trying to set the height and width of one of my image views. I want to set it so the height only goes for 20% of my screen. I know to regularly set it you can do things like:
image = (0,0,50,50)

But I need the height to not be a static number.
Something like image = (0,0, frame.height * 0.2, 50)

Any suggestions?

let screenSize: CGRect = UIScreen.mainScreen().bounds
image.frame = CGRectMake(0,0, screenSize.height * 0.2, 50)