X $ C $Ç自动版式,使保证金比例随高度 [英] Xcode AutoLayout, Make Margin proportional with height

查看:162
本文介绍了X $ C $Ç自动版式,使保证金比例随高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大的时间搞清楚如何让两个物体的保证金比例。如果我选择在X $ C $纵横比C它给我调整我的目标比例屏幕高度的高度的选项。并且那不是我的情况。我希望有一个按钮与屏幕底部之间的差额正比于屏幕的高度。我想它利用X code没有code来完成。

I am having a big time figuring out how to make the margin of two objects proportional. If i choose aspect ratio on Xcode it gives me the option for adjust the height of my object proportional screen height. and thats not my case. I want the margin between a button and screen bottom to be proportional to screen height. And i want it to be done using Xcode "No Code".

您的支持是高度AP preciated。

Your support is highly appreciated.

感谢您

推荐答案

使用NSLayoutConstraint的乘数财产!

Use the multiplier property of NSLayoutConstraint !

首先,从你的观点的平等高度约束设置为与您希望乘数上海华。您可以使用Ctrl +拖动从您欣赏到上海华。

First, set the equal height constraint from your view to its superview with the multiplier you wish. You can use Ctrl + drag from your view to the superview.

然后从视图顶部到上海华设置其他限制在0和平等的宽度从您欣赏到上海华乘数为1约束。

Then set another constraint at 0 from the top of your view to the superview and a equal width constrain with a multiplier to 1 from your view to the superview.

完成!

这篇关于X $ C $Ç自动版式,使保证金比例随高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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