[英]Why CollectionView cell insider other collectionView has wrong size?
I have a collectionView (nested) inside a collectionViewCell.我在 collectionViewCell 中有一个 collectionView(嵌套)。 When I open this VC, the cell inside nested collectionView have wrong size.
当我打开这个 VC 时,嵌套 collectionView 中的单元格大小错误。 After scroll down and up - everything is fine.
向下和向上滚动后 - 一切都很好。 I think when I am scrolling method
layoutSubviews
are calling.我想当我滚动时调用
layoutSubviews
方法。 But when I added cell.setNeedsLayout() cell.layoutIfNeeded()
inside func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)
the result is not change.但是当我在
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)
中添加cell.setNeedsLayout() cell.layoutIfNeeded()
时,结果没有改变。
i think problem is not with the size, it is from constraints.我认为问题不在于尺寸,而在于限制。
Would you please share a snippet of your code你能分享你的代码片段吗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.