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
and
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?
size. width = 200; newFrame. size. height = 200; [self setFrame:newFrame]; CGRect newFrame = self.
If you want to get the view's size: float viewWidth = view. Frame. Width; float viewHeight = view.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With