[英]Constraints ambiguously suggest a height of zero for tableview cell's content view
This warning is driving me crazy: 这个警告使我发疯:
[Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view.
[警告]仅警告一次:检测到一种情况,即约束对于表视图单元格的内容视图含糊其词暗示高度为零。 We're considering the collapse unintentional and using standard height instead.
我们考虑的是无意倒塌,而是改用标准高度。
I have a UICollectionView inside a UITableViewCell. 我在UITableViewCell中有一个UICollectionView。 The table view cell has auto row height, and the collection view has cell size of 44x44.
表格视图单元格具有自动行高,集合视图单元格尺寸为44x44。 The collection view cell has default size.
集合视图单元格具有默认大小。 I have a button inside the collection view cell with constraints pinning it to the top, bottom, left, and right of the cell (I also tried manually setting its size to 44x44).
我在集合视图单元格中有一个按钮,该按钮具有将其固定在单元格的顶部,底部,左侧和右侧的约束(我也尝试过手动将其尺寸设置为44x44)。 You can see the rest of the constraints in the following image:
您可以在下图中看到其余的约束:
When I try to set the Table View Cell Row Height as custom equal to 44, I get an error that the constraints are conflicting and one of them needs to be removed. 当我尝试将“表格视图单元格行高”设置为自定义等于44时,我收到一个错误,指出约束冲突,需要删除其中之一。 When I set it to 50, I get the warning above again.
当我将其设置为50时,我再次收到以上警告。
Any ideas? 有任何想法吗? :S
:S
Thanks! 谢谢!
make sure in your cell class to define constraints in a such way that cell contentView will have a least 1px height/width (eg height constraint >= 1) 确保在您的单元格类中以这样的方式定义约束,即单元格contentView的高度/宽度至少为1px(例如,高度约束> = 1)
I do like this (collectionView is a subview of cells contentView) 我喜欢这样(collectionView是cell contentView的子视图)
collectionView.heightAnchor.constraint(greaterThanOrEqualToConstant: 1).isActive = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.