常规/常规位置大小的限制对所有的iPad,iPad的包括亲? [英] Regular / Regular position sizing constraints for all iPads, including iPad pro?

查看:114
本文介绍了常规/常规位置大小的限制对所有的iPad,iPad的包括亲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用乘法器在我的限制,大小我的看法。然而,在我的位置限制我使用的值,这是我对不同大小的类改变。

I've used multipliers in my constraints, to size my views. However in my constraints for position I've used values, which I change for different sizing classes.

不过使用普通/常规大小的类iPad的临它的位置值不够大,但对其他台iPad它的罚款。

However using regular / regular sizing classes for iPad Pro it's positions values aren't big enough, but for other iPads it's fine.

我严重不必与乘数为我所有的观点提供个场所,以及做我添加定位的看法?

I seriously don't have to add positioning views with multipliers to provide percentage spaces for all my views as well do I?

推荐答案

我们以后什么是设置在屏幕的顶部和子视图与相对于屏幕大小顶部之间的空白。这意味着约束必须进行相关的上海华的高度。

What we're after is to set the margin between the top of the screen and the top of the subview with relation to the size of the screen. This means the constraint must be related to the superview's height.

尝试设置两种观点(在传统意义上的)之间的距离实际上是一个的的在这种情况下的想法。相反,试试这个。

Trying to set the distance between the two views (In the traditional sense) is actually a bad idea in this case. Instead, try this.

添加制约了上海华垂直居中你的看法。现在,打开在尺寸检查约束(右工具栏)。

Add a constraint to center your view vertically in the superview. Now, open up the constraint in the size inspector (The right toolbar).

如果您的乘数设定为0.01(0只是把它背在屏幕的中心),你的观点会经过屏幕的顶部。从中心Ÿ更改的第一项的顶部。现在,您的观点将在上面!

If you set the multiplier to 0.01 (0 just puts it back in the center of the screen), your view will go past the top of the screen. Change the first item from Center Y to Top. Now your view will be at the top!

在这里,您可以修改以移动视图下一个固定的数额,并更改乘数以进一步下降移动视图的按比例到屏幕的高度。该公式看起来像

From here, you can change the constant to move your view down a fixed amount and change the multiplier to move your view down further proportionally to the screen's height. The formula would look like

subViewYPosition = constant + (superviewHeight * multiplier)

您将需要调整常数和乘数,以满足您的需求,但我相信这是一个很好的解决了这个问题。
这样的一个例子如下所示。

You will need to adjust the constant and multiplier to suit your needs, but I believe this is a good solution to the problem. An example of this is shown below.

在这里输入的形象描述

这篇关于常规/常规位置大小的限制对所有的iPad,iPad的包括亲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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