UICollectionView 总是自动调整单元格大小.不使用从委托返回的大小 [英] UICollectionView always auto sizing cells. Not using sizes returned from delegate
问题描述
最近升级到 Xcode 11/iOS13.在一个新的视图控制器上工作.UICollectionView 正在调用我的 sizeForItemAtPath 委托方法,但似乎集合视图总是根据约束选择自我调整大小.但我不想它!
我尝试将estimatedSize 设置为1x1 只是为了尝试解决这个问题.没用.我已经在所有委托/数据源方法上断点并且没有看到任何异常.
我也遇到过这个问题(
改为无:
Recently upgraded to Xcode 11 / iOS13. Working on a new view controller. The UICollectionView is calling my sizeForItemAtPath delegate method, but it seems like the collection view is always choosing self sizing based on constraints. But I don't want it to!
I tried setting the estimatedSize to 1x1 just to try and work around this. Didn't work. I've breakpointed on all the delegate / datasource methods and don't see anything out of the ordinary.
I also came across this (`systemLayoutSizeFittingSize` not called on iOS 13), maybe my issue is related? I am able to fix the issue by overriding the systemFittingSize method in that link - but I really shouldn't have to.
The odd thing I find is that any existing xibs with collection views are working as expected - the only difference seems to be me creating the cell / collection view with Xcode 11 VS Xcode 10.
I also noticed that UICollectionViewCell elements in Xcode11 contain a "Content View" - but Xcode 10 xibs don't have a Content View.
Anyone else experience this?
There's a setting in interface builder for estimated size - set it to None.
Change to None:
这篇关于UICollectionView 总是自动调整单元格大小.不使用从委托返回的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!