[英]Auto-layout issue
更新
对于特定比率:据我所知,我们可以为Centre Vertically Constraints
提供乘数。 这里的上下空间比例在所有 iPhone 系列中都是一样的。 我给乘数为1.4
==================================
我知道那里有几个答案。 但是,没有人使用UIStackView
添加两个简单的按钮。
拖动两个 UIButton,选择那两个 UIButton,从这里单击Embed in Stack
图标。
堆栈视图属性
为 UIStackView 提供以下内容,
在Attributes Inspector
中将Axis
设置为Horizontal
, Distribution
为Fill Equally
, Spacing
为10
Stackview 约束 1
为该 UIStackView 提供约束,选中/取消选中边距,左右 = 0,高度为 30。
Stackview 约束 2
尽管如此,一些限制条件仍未得到满足。 按住Control
并按住它,单击StackView
并拖动到SuperView
,您将弹出黑色。 Center Vertically in container
选择Center Vertically in container
。
Stackview 约束自定义
如果要更改 UIButton 或底部空间的高度,请单击 UIStackView 并在Size Inspector
,您可以更改高度或上下移动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.