自动版式:带比例元素与3.5英寸间距布局的一致性;和4英寸屏幕 [英] AutoLayout: layout consistency with proportional element spacing with 3.5" and 4" screens
问题描述
我想使用自动版式与他们之间的比例垂直间距(避免重茬3.5的屏幕,避免4底部的空白空间屏幕)位置控制。
在其他的答案的建议,我可以使用带有高度相等的束缚,改变乘数在必要间隔的意见。然而,最终的布局是不是像素完美的,所以发动机不能始终如一他们的位置。
症状:
-
当我一个更新所有帧,在IB,它不修复错位的意见,而只是与其他组的错位意见替换它们。
-
更重要的是,在运行时,我可以看到控制瞬间跳了几个像素向上或向下,每当我进入查看。
怎么我每次都达到同样一致的布局?
- 的控件要在屏幕上垂直放置设置身高限制
- 的高度限制创建店铺。
- 对于3.5英寸和4英寸的屏幕,改变高度限制保持不变。 价值
- 如果更改高度不能解决宗旨,打造垂直空间的限制,并相应地设置自己的值。
I want to use AutoLayout to position controls with proportional vertical spacing between them (avoid cropping on a 3.5" screen, avoid blank bottom space on a 4" screen).
As suggested in other answers, I can use spacer views with "Equal Height" constraints, changing multiplier where necessary. However, the final layout is not pixel-perfect, so the engine can't position them consistently.
The symptoms:
When I do an "Update All Frames" in IB, it doesn't fix misplaced views, but merely replaces them with other set of misplaced views.
More importantly, at run time, I can see the controls momentarily jump a few pixels up or down, whenever I enter the view.
How to I achieve the same consistent layout every time?
- Set Height constraints for the the controls which you want to place on the screen vertically
- Create outlets for the height constraints.
- For 3.5 inch and 4 inch screen, change the value of height constraints' constant.
- If changing the height doesn't solve the purpose, create Vertical Space Constraints and set their values accordingly.
这篇关于自动版式:带比例元素与3.5英寸间距布局的一致性;和4英寸屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!