gpt4 book ai didi

ios - 为什么在 Xcode 11 上,UICollectionViewCell 一旦滚动就会改变大小(我已经在 sizeForItem AtIndexPath :)? 中设置了大小

转载 作者:行者123 更新时间:2023-12-02 05:23:41 25 4
gpt4 key购买 nike

enter image description here

我在 TableView 单元格中有 Collection View ,并且我使用 Nib 作为我的 Collection View 单元格(其中我对 ImageView 和标签使用自动布局,并且它处于自由格式模式)。我在 tableviewcell 类中设置单元格大小,该类通过以下方法处理其中的 collectionview 委托(delegate):

 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 200, height :150)
}

它总是有效,但在 Xcode 11 之后就不行了。

最佳答案

我也有同样的问题。我的解决方案是在 Xcode 11 中将 Estimate size 更改为 None

enter image description here

关于ios - 为什么在 Xcode 11 上,UICollectionViewCell 一旦滚动就会改变大小(我已经在 sizeForItem AtIndexPath :)? 中设置了大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56840665/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com