问题描述
和视图2
在屏幕上。
我怎样才能使汽车的布局,厂景的高度会= 3.7 view2的高度?
也许这可以通过增加code约束来完成。但我想知道所有的解决方案。
I have view1
and view2
on screen.how can I make in auto layout that view1 height will be = 3.7 view2 height?Maybe that can be done by adding constraints in code. But I want to know all solutions.
此外,它如何能做到这一点厂景高度将是= 3 view2的高度?我认为,可以通过将2更多的意见来完成(viewAdditon1,viewAdditon2)
。这样
Also how It can be done that view1 height will be = 3 view2 height? I think that can be done by adding 2 more views (viewAdditon1, viewAdditon2)
. so that
厂景,viewAdditon1,viewAdditon2都享有平等的高度。也view1.y顶部= view2.y顶部。也viewAdditon1.y底部= view2.y底部。结果
viewAdditon1.y底部= viewAdditon2.y顶部。 viewAdditon2.y底部= view1.y顶部。
view1 ,viewAdditon1, viewAdditon2 will have equal height. also view1.y top = view2.y top. and also viewAdditon1.y bottom = view2.y bottom.
viewAdditon1.y bottom = viewAdditon2.y top. viewAdditon2.y bottom = view1.y top.
另外的问题。如何使一个正方形的看法?或如何使厂景高度= 0.7 *宽视图2?
Also question . How to make a square view? Or how to make that view1 height = 0.7 * view2 width?
另外的问题。如何使厂景BUTTOM之间的空间和视图2顶部= 1/4 VIEW3高度?我知道,可使用view4这个空间来完成。所以view4高度= 1/4 VIEW3高度。和view4将厂景和视图2之间。马布有其他解决办法?
Also question . How to make space between view1 buttom and view2 top = 1/4 view3 height? I know that can be done using view4 for this space. so view4 height = 1/4 view3 height . and view4 will be between view1 and view2. mabe there is other solutions?
推荐答案
下面是如何使用自动布局设置由故事板的另一种观点的看法2/3的例子:
Here is an example of how to use autolayout to set a view 2/3 of the other view by storyboard:
假如你已经设置的所有包含了除这两种观点的高度。
Assuming that you have set all contains except height of this two views.
现在控制从视图2
拖动厂景
。选择的高度相等
。
Now control drag from view2
to view1
. Selected Equal Heights
.
,然后选择这包含了你刚才说。更改乘
到 2/3
。
And then select this contains you added just now. Change the Multiplier
to 2/3
.
这就是全部。
希望这可以帮助别人。
这篇关于我怎样才能使汽车的布局,厂景的高度会= 3.7 view2的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!