如何将领先空间提升为SuperView宽度的1/3

编程入门 行业动态 更新时间:2024-10-25 05:29:02
本文介绍了如何将领先空间提升为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.

更多推荐

如何将领先空间提升为SuperView宽度的1/3

本文发布于:2023-11-25 13:48:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630003.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:宽度   如何将   空间   SuperView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!