【问题标题】:Why CollectionView cell insider other collectionView has wrong size?为什么 CollectionView 单元格内部其他 collectionView 的大小错误?
【发布时间】:2026-01-15 14:35:02
【问题描述】:

我在 collectionViewCell 中有一个 collectionView(嵌套)。当我打开这个 VC 时,嵌套 collectionView 中的单元格大小错误。向下和向上滚动后 - 一切都很好。 我想当我滚动方法时layoutSubviews 正在调用。 但是当我添加 cell.setNeedsLayout() cell.layoutIfNeeded()func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) 里面结果没有变化。

约束:

【问题讨论】:

    标签: ios swift uicollectionview uicollectionviewcell


    【解决方案1】:

    我认为问题不在于尺寸,而在于限制。

    你能分享一下你的代码的sn-p吗

    【讨论】:

    • 我添加了约束截图
    最近更新 更多