[英]UIStackView : Change UIStackView image width using storyboard
The issue : Image take most of the stack and text shrinks 问题:图像占用大部分堆栈和文本缩小
I tried to change content hugging priority but no changes ! 我试图更改内容拥抱优先级但没有更改!
How to do it in UIStackview using storyboard ? 如何使用故事板在UIStackview中执行此操作?
What I want the cell to look like Eventbright event Cell? 我希望细胞看起来像Eventbright事件Cell?
What I got is an image that take most of the cell? 我得到的是一个占据大部分细胞的图像?
Instead of Fill
, change the Distribution
of the UIStackView
to Fill Proportionally
and add constraints for the width of each element. 而不是Fill
,将UIStackView
的Distribution
更改为Fill Proportionally
并为每个元素的宽度添加约束。 Those constraints will serve as a guide to proportions on one element to each other and not as fixed sizes. 这些限制将作为一个元素相互之间比例的指导,而不是固定大小。
I tried it the following way. 我尝试了以下方式。 The overall set up is given in pic: 整体设置以图片形式给出:
At run time result is as given: 在运行时结果如下:
From control and drag select equal width. 从控制和拖动选择相等的宽度。 as shown 如图所示
Hope it can help 希望它可以提供帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.