将高度UILabel设置为0 [英] Set height UILabel to 0

查看:157
本文介绍了将高度UILabel设置为0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过编程设置UILabel的高度?我在.Xib文件中添加了一堆约束,因此每个其他标签的位置都取决于它上面或下面的标签.如果我可以使用,它将使我的生活变得更加轻松:

Is there anyway to set the height of a UILabel programmatically? I've added a bunch of constraints to my .Xib files so every other label is dependent upon the one above or below it for it's positioning. It'd make my life so much easier if I could just use:

nameLabel.height = 0 

我的.Xib看起来像这样:

My .Xib looks like this:

推荐答案

plz获取约束高度的IBoutlet并设置所需的高度

plz take the IBoutlet of constraint height and set the height you want

这篇关于将高度UILabel设置为0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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