UIView-Encapsulated-Layout-Height和容器视图 [英] UIView-Encapsulated-Layout-Height and Container View
问题描述
我有UIViewController 1
,也有scroll view
.在scrollview
内部有container view
固定到top/bottom leading/trailing
(没有固定高度). Container view
将UITableView
固定到top/bottom trailing/leading
和height constraint with 0 constant
,这将在updateViewConstraints
中更改为内容大小的高度.
I have UIViewController 1
, that has scroll view
. Inside this scrollview
there is container view
that pinned to top/bottom leading/trailing
(without fixed height). Container view
has UITableView
pinned to top/bottom trailing/leading
and height constraint with 0 constant
, that will change in updateViewConstraints
to content size height.
当UIViewController 1的视图出现时,容器视图具有约束:
When View of UIViewController 1 appears, Container View has constraint:
NSLayoutConstraint:0x7b03e5f0 V:[UITableView:0x7c42a200(54)], NSLayoutConstraint:0x7b0ba120 V:|-(0)-[UITableView:0x7c42a200](名称:'|':UIView:0x7b0b7000), NSLayoutConstraint:0x7b0ba1b0 V:[UITableView:0x7c42a200]-(0)-| (名称:"|":UIView:0x7b0b7000), NSLayoutConstraint:0x7b65f900'UIView-Encapsulated-Layout-Height'V:[UIView:0x7b0b7000(0)]
NSLayoutConstraint:0x7b03e5f0 V:[UITableView:0x7c42a200(54)], NSLayoutConstraint:0x7b0ba120 V:|-(0)-[UITableView:0x7c42a200] (Names: '|':UIView:0x7b0b7000 ), NSLayoutConstraint:0x7b0ba1b0 V:[UITableView:0x7c42a200]-(0)-| (Names: '|':UIView:0x7b0b7000 ), NSLayoutConstraint:0x7b65f900 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7b0b7000(0)]
将尝试通过打破约束来恢复
Will attempt to recover by breaking constraint
NSLayoutConstraint:0x7b03e5f0 V:[UITableView:0x7c42a200(54)]
NSLayoutConstraint:0x7b03e5f0 V:[UITableView:0x7c42a200(54)]
什么是UIView-Encapsulated-Layout-Heigh
t?我如何跳过它?因为它打破了正确的"约束(我将其更新为内容大小的高度).谢谢
What is UIView-Encapsulated-Layout-Heigh
t? How can i skip it?Because it breaks "right" constraint(that i update to content size height).Thanks
推荐答案
最后,我解决了这个问题.
1.在tableView设置中,设置:tableView.estimatedRowHeight = 100
.
2.在单元格的最后一个视图中,设置:make.bottom.equalTo(contentView).priority(999)
.
3.运行您的代码,也许没关系!
Finally i solve this problem.
1. In your tableView setting, set: tableView.estimatedRowHeight = 100
.
2. In the last view of your cell, set: make.bottom.equalTo(contentView).priority(999)
.
3. Run your code, maybe it's ok!
这篇关于UIView-Encapsulated-Layout-Height和容器视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!