在我的应用程序中,我有一个UITableViewCell
,其中包含三个UILabel
和一个自定义分隔符行UIView
。
这三个UILabels
的内容完全dynamic
,约为3-4行。
我的前两个标签工作正常但我的第三个标签没有增加它的高度。这是我的设置:
我的约束如下:
第一视图:
Leading to Superview - Trailing to SuperView- Top to Super View - Bottom To Second View - Height > 30
First Label:
Leading to First View - Trailing to First View - Top To First View - Bottom to First View - Height=20 - Width
First Label Discription Label
Leading to First View - Trailing to First View - Top to First View - Bottom to First View - Height > 20
第二视图:
Leading to Superview - Trailing to SuperView- Top to First View - Bottom To Third View - Height > 30
Second Label:
Leading to Second View - Trailing to Second View - Top To Second View - Bottom to Second View - Height=20 - Width
Second View Discription Label
Leading to Second View - Trailing to Second View - Top to Second View - Bottom to Second View - Height > 20
第三视图:
Leading to Superview - Trailing to SuperView- Top to Second View - Bottom To SeparatorView - Height > 30
Th Label:
Leading to Second View - Trailing to Second View - Top To Third View - Bottom to Third View - Height=20 - Width
Third View Discription Label
Leading to Third View - Trailing to Third View - Top to Third View - Bottom to Third View - Height > 20
Separtaor View
Leading to Super View - Super to Third View - Top to Third View - Bottom to SuperView - Height =1
我在更新后正在调用-updateData()
我正在调用[self.contentView layoutIfNeeded];
。
所有UILabel
都有numberOfLines
:10
这是输出:
我几乎尝试了所有可能的方式:
[self updateConstraints];
[self needsUpdateConstraints];
[self setNeedsLayout]; and many more solutions available on SO.
但是无法制作第三个标签动态。请有人建议我做错了什么。