SKYnine SKYnine - 5 months ago 375x
Swift Question

How do I change UIView Size?

I have trouble with modifying my UIView height at launch.

I have to UIView and I want one to be screen size * 70 and the other to fill the gap.

here is what I have

@IBOutlet weak var questionFrame: UIView!
@IBOutlet weak var answerFrame: UIView!
let screenSize:CGRect = UIScreen.mainScreen().bounds


questionFrame.frame.size.height = screenSize.height * 0.70
answerFrame.frame.size.height = screenSize.height * 0.30

It has no effect on the app during run time.
I use autolayout but I only have margins constraints...

Am I doing it all wrong?


Here you go. this should work.

questionFrame.frame = CGRectMake(0 , 0, self.view.frame.width, self.view.frame.height * 0.7) 

answerFrame.frame =  CGRectMake(0 , self.view.frame.height * 0.7, self.view.frame.width, self.view.frame.height * 0.3)