如何更改 UIView 大小? [英] How do I change UIView Size?

查看:30
本文介绍了如何更改 UIView 大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在启动时修改 UIView 高度时遇到问题.

I have trouble with modifying my UIView height at launch.

我必须使用 UIView,我想要一个屏幕尺寸 * 70,另一个来填补空白.

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

这是我所拥有的

 @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...

我做错了吗?

推荐答案

给你.这应该有效.

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)

这篇关于如何更改 UIView 大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆