UIButtons之间的自动布局相等空间
问题描述
我是自动布局的新手,所以在这里阅读堆栈中的一些问题我试图将单元格底部的 5 个 UIButton 对齐以具有相等的空间(例如 7 个点),我尝试使用代码和它不起作用.
I'm new in auto layout so reading a bit questions here in stack I'm trying to align my 5 UIButtons at the bottom of the cell to have equal space (of 7 points for example), I tried using code and it doesn't work.
我的问题是 - 我如何使用 Interface Builder 来做到这一点?
My question is - how can I do it using Interface Builder?
错误:
推荐答案
我发现用 IB 做到这一点的唯一方法是在要均匀分布的视图之间创建间隔视图,并连接它们的所有边到要均匀分布的视图的相邻边缘.你给他们可变的宽度/高度,然后添加约束,说所有的间隔视图必须具有相同的宽度/高度.
The only way I've found to do this with IB is to create spacer views between the views that you want to distribute evenly, with all of their edges connected to the neighboring edges of the views that you want to distribute evenly. You give them variable width/height, and then add constraints that say that all of the spacer views must have the same width/height.
设置起来非常繁琐,但确实有效.
It's very tedious to set up, but it does work.
这篇关于UIButtons之间的自动布局相等空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!