UIView动态高度取决于标签高度 [英] UIView dynamic height depending on Label Height

查看:350
本文介绍了UIView动态高度取决于标签高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Label,它从动态数据库中获取一些数据。
这些数据是字符串,有时可以是3-4-5行等等。
所以这个labe在UIView里面。

I have a Label which takes dynamicaly some data from database. These data are strings which can sometimes be 3-4-5 rows etc. So this labe is inside a UIView.

--UIView
  --Label

我如何制作 UIView 获取标签动态的某个高度??

How can i make the UIView to take the certain height of the Label dynamicaly??

推荐答案

你可以用故事板来做这个照片

you can just do it with storyboard this pics

将标签高度关系设置为大于或等于

set the label height relation to greater than or equal

并将视图高度关系设置为大于或等于

and set the view height relation to greater than or equal

它像魔术一样工作

这篇关于UIView动态高度取决于标签高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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