【发布时间】: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