我正在尝试使用界面生成器创建一个完美的比例视图。到目前为止,一切都很好。我正在以编程方式缩放字体、按钮等。唯一的问题是元素之间的约束(间距)保持不变。我想避免为间距限制创建出口,因为它看起来很混乱。我希望元素之间的间距在拉伸元素时保持成比例。现在一切都根据屏幕左侧对齐。如果我扩展视野,一切都会保持左对齐。我希望它全部按比例分开。我怎样才能做到这一点(最好使用界面生成器)?
假观点???你肯定是在逗我。如果这就是苹果公司的建议——那么我就不太尊重他们了。
您显然要寻找的是中心水平(中心 X 对齐)约束,然后您只需使用乘数,同时将常数保持为 0:
乘数从 0 到 2
1 will place the center of the subview at the center of the superview.
0 will place the center of the subview at the left edge of the superview.
2 will place the center of the subview at the right edge of the superview.
0.5 will place the center of the subview at 25% through the superview.
1.5 will place the center of the subview at 75% through the superview.
摆脱所有这些水平空间限制。并且始终考虑乘数 - 约束常数应始终设置为 0。
苹果痴迷于原生分辨率 - 他们不希望你的设计在不同的屏幕尺寸上缩放。拧他们。一路缩放分辨率。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)