Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 

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?

like image 301
SKYnine Avatar asked Nov 03 '14 01:11

SKYnine


People also ask

How do you change the size of programmatically in UIView?

size. width = 200; newFrame. size. height = 200; [self setFrame:newFrame]; CGRect newFrame = self.

How do I get UIView size?

If you want to get the view's size: float viewWidth = view. Frame. Width; float viewHeight = view.


1 Answers

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) 
like image 199
User4 Avatar answered Sep 30 '22 17:09

User4