Ios UICollectionView布局在滚动时表现异常

Ios UICollectionView布局在滚动时表现异常,ios,swift,uicollectionview,uicollectionviewdelegate,uicollectionviewdelegateflowlayout,Ios,Swift,Uicollectionview,Uicollectionviewdelegate,Uicollectionviewdelegateflowlayout,我正在设置收藏视图,以便在instagram上显示内容 为了设置布局,我使用UIcollectionviewDelegateFlowLayout的一些委托方法: 当我打开项目时,collectionView运行良好。 当您快速向下滚动collectionView,使所有单元格瞬间消失时,就会出现问题。 就在那一刻,我之前设置的单元格布局不起作用,图像变得超缩放,一个在另一个上面,如下所示: 我不知道如何解决这个问题。 在编译器中,我还遇到以下错误: the item width must be

我正在设置收藏视图,以便在instagram上显示内容

为了设置布局,我使用UIcollectionviewDelegateFlowLayout的一些委托方法:

当我打开项目时,collectionView运行良好。 当您快速向下滚动collectionView,使所有单元格瞬间消失时,就会出现问题。 就在那一刻,我之前设置的单元格布局不起作用,图像变得超缩放,一个在另一个上面,如下所示: 我不知道如何解决这个问题。 在编译器中,我还遇到以下错误:

the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.

Please check the values returned by the delegate.
The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout:   0x7fbbe972d1f0>, and it is attached to <UICollectionView: 0x7fbbeb056400; frame = (0 0; 414 896); clipsToBounds = YES; autoresize = RM+BM; 
gestureRecognizers = <NSArray: 0x60000203c4e0>; layer = <CALayer: 0x600002ef19c0>; contentOffset: {0, 424}; contentSize: {414, 16048}; adjustedContentInset: {88, 0, 83, 0}; layout: <UICollectionViewFlowLayout: 0x7fbbe972d1f0>; dataSource: <InstagramClone.ProfileViewController: 0x7fbbe9708890>>.
项目宽度必须小于UICollectionView的宽度减去部分插入的左侧和右侧值,再减去内容插入的左侧和右侧值。
请检查委托返回的值。
相关的UICollectionViewFlowLayout实例为,并已附加到。

我认为您的问题可能与此中的问题相同

尝试通过将
UICollectionView的estimatedSize设置为none来解决问题

这是因为在Xcode 11中,CollectionView中的单元格现在可以通过画布中的自动布局约束视图自行调整大小

the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.

Please check the values returned by the delegate.
The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout:   0x7fbbe972d1f0>, and it is attached to <UICollectionView: 0x7fbbeb056400; frame = (0 0; 414 896); clipsToBounds = YES; autoresize = RM+BM; 
gestureRecognizers = <NSArray: 0x60000203c4e0>; layer = <CALayer: 0x600002ef19c0>; contentOffset: {0, 424}; contentSize: {414, 16048}; adjustedContentInset: {88, 0, 83, 0}; layout: <UICollectionViewFlowLayout: 0x7fbbe972d1f0>; dataSource: <InstagramClone.ProfileViewController: 0x7fbbe9708890>>.