根据UITableViewCell中的UILabel文本更改UIView宽度 [英] Change `UIView` Width as per `UILabel` Text in `UITableViewCell`

查看:57
本文介绍了根据UITableViewCell中的UILabel文本更改UIView宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的UITableViewCell中,有一个UIView具有宽度约束,并且在其中有图像和UILabel.

In my UITableViewCell there's UIView with Width Constraint and inside it there's Image and UILabel.

推荐答案

UIStackView内添加视图,并在该视图内添加标签和imageView并为标签和imageView设置适当的约束.并删除所有用于计算尺寸的代码.

Add your view inside UIStackView and inside that view add your label and imageView and set proper constraint to label and imageView. and remove all code for calculation of size.

这篇关于根据UITableViewCell中的UILabel文本更改UIView宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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