如何将领先空间提升为SuperView宽度的1/3 [英] How To Get Leading Space To Be 1/3 The Width Of the SuperView

查看:106
本文介绍了如何将领先空间提升为SuperView宽度的1/3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将图标设置为沿超视图宽度的1/3。

I am trying to set an icon to be 1/3 along the width of the superview.

然而,当我设置宽度时,它只给我硬值选项。

However when I set the width it's only give me hard values as the option.

是否可以通过界面构建​​器将对象的x位置设置为宽度的1/3?

Is it possible to set the x position of an object to be 1/3rd the width through the interface builder?

谢谢

更新:

尝试针对.width设置.leading似乎不是领先选项:

Trying to set a .leading against a .width does not appear to be an option for leading:

推荐答案

你应该在图标的centerX和superview的尾随之间做出约束。在下面的图像中,第一个和第三个图标指的是第一个和第三个图标。约束将使第一个从左边缘开始1/3,而第三个约束从右边缘开始的1/3。

You should make the constraint between the icon's centerX and the superview's trailing. In the images below, first, and third refer to the first and third icons. The constraints will put the first one 1/3 of the way from the left edge, and the third one 1/3 of the way in from the right edge.

< img src =https://i.stack.imgur.com/tsmOk.pngalt =在此输入图像说明>

这篇关于如何将领先空间提升为SuperView宽度的1/3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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