OGeek|极客世界-中国程序员成长平台

标题: ios - UILabel 多行不工作 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:14
标题: ios - UILabel 多行不工作

我一直在使用 UILabel 通过设置 numberOfLines = 0 在许多项目中显示多行文本。今天我遇到了奇怪的行为 UILabel 尽管设置了正确的设置来显示多行,UILabel 并没有扩大它的高度。即使设置明确的 2、3 等行数也不起作用。

UILabel 设置:

enter image description here

约束

enter image description here

我不确定 Swift4 中是否有问题或更新。



Best Answer-推荐答案


你应该在lines属性中用2替换0 enter image description here

关于ios - UILabel 多行不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50760317/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4