当前位置 : 主页 > 手机开发 > ios >

ios – 水平stackview标签与固定高度元素一起成长

来源:互联网 收集:自由互联 发布时间:2021-06-11
我有一个水平stackview与UI ImageView(1:1 Aspect Rati,Height 32)和一个标签.由于它有一个高度,stackView切断了我右边的标签,不让我拥有多条线. 我希望Horizo​​ntal StackView在高度上增长,因为标签需
我有一个水平stackview与UI ImageView(1:1 Aspect Rati,Height 32)和一个标签.由于它有一个高度,stackView切断了我右边的标签,不让我拥有多条线.

enter image description here

我希望Horizo​​ntal StackView在高度上增长,因为标签需要显示自己的文本或者如果它更大则使用UIImageView高度.

enter image description here

这是完整的解释,

如果您没有为Imageview提供任何高度,那么它的外观如何

enter image description here

ImageView grows

如果你为Imageview提供高度,

enter image description here

Label shrinks to the height of imageview

解

把ImageView放在如下的视图中,

enter image description here

现在,为imageview提供适当的约束.现在它正常工作.

输出:

enter image description here

网友评论