如何解决在我的案例 UILabel 和 UITextField 中,如何减少 UI 组件之间的宽度
我有一个 UILabel(空格)UITextField。 UITextField 是右对齐的,每当用户输入 UITextField 字段时,应减少 UILabel 之间的水平空间。下面一行来自 UIView,它具有与 UITextField 相同的宽度。如何在不重叠 UILabel 的情况下通过适当的约束实现这一点?
解决方法
所以你想要这样的东西?
以下是您需要的约束条件:
结果:
编辑:防止文本字段覆盖标签
您需要:
- 在标签和文本字段之间添加
greater than or equal to
约束 - 将标签的
horizontal compression resistance
设置为751
而不是750
。
我制作了这个 video 以便您可以跟随。
结果:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。