多行标签和带有 UIStackView 的图像 [英] Multi Line Labels and an Image with UIStackView

查看:44
本文介绍了多行标签和带有 UIStackView 的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看看是否可以轻松地使用 UIStackView 创建多行标签并显示图像.

I am trying to see if I can easily use a UIStackView to create multi line labels and also display an image.

这是我目前的限制条件.

Here are my current constraints.

当我运行它时,我得到以下内容:

When I run it I get the following:

如果我删除图像视图,则多行工作.不知何故 UIImageView 宽度和高度搞砸了一切.我做错了什么?

If I remove the imageview then the multi line works. Somehow UIImageView width and height is messing up everything. What am I doing wrong?

推荐答案

更改 imageView 的高度和宽度以提供适当的外观,不要为 stackview 提供固定高度,只提供顶部、底部、前导和尾随.

Change height and width of the imageView to give proper look and don't give fixed height for the stackview, only give top, bottom, leading and trailing.

这就是它的样子

这篇关于多行标签和带有 UIStackView 的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆