如何将堆栈视图与4个元素和堆栈视图相结合,并在XIB中使用5个元素?
我正在通过XIB创建自定义的NUMPAD键盘。
NUMPAD有4行:3行,带5个按钮,最后1行带有4个按钮。
我不明白,如何对齐黄色按钮“ =”的宽度等于Uper Row的2个黄色按钮“+”和“ X”的宽度。加上3个灰色按钮宽度与上3个灰色按钮相同?
我不想添加像每个黄色按钮宽度这样的硬编码值等于60,然后“ =”按钮宽度等于120。
这就是现在的样子:

我尝试使用Google进行Google以获取解决方案,但发现只有4个元素的情况,不是5。
这是github上的测试项目:单击
I am creating a custom Numpad keyboard through xib.
The numpad has 4 rows: 3 rows with 5 buttons and 1 last row with 4 buttons.
I can't understand, how to align a width of a yellow button "=" to be equal of doubled width of upper row's 2 yellow buttons "+" and "x". Plus 3 grey buttons width to be the same as upper 3 grey buttons have?
I don't want to add hardcoded values like each yellow button width equals 60 then "=" button width equals 120.
This is how it looks now:
I tried to google for solution, but found the cases only with 4 elements in a row, not 5.
Here is the test project on Github: CLICK
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎有很多不必要的嵌入在额外的视图和堆栈视图中...
看看:
<
这是该XIB的来源(取出空格,因此适合此答案):
You have what appears to be a lot of unneeded embedding in extra views and stack views...
Take a look at this:
Here's the source for that xib (took out whitespace so it would fit in this answer):