gpt4 book ai didi

ios - UICollectionView 在 moveItemAtIndexPath :toIndexPath: 后停止加载单元格

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:37:31 26 4
gpt4 key购买 nike

我有一个 UICollectionViewUICollectionViewFlowLayout,其中包含许多项。由于用户输入,我想重新排序一个单元格。

[self.collectionView moveItemAtIndexPath:indexPath toIndexPath:newIndexPath];

执行此代码后, Collection View 不会在滚动时更新其内容。它不显示下一个单元格。它甚至不调用 cellForItemAtIndexPath: 但它的内容大小是正确的(布局“更新”它的状态)。因此我们只能看到在重新排序之前分布在 Collection View 上的单元格。任何线索可能是什么问题?此问题是否有任何已知的解决方法?该应用仅适用于 iOS 8, Collection View 与 UICollectionViewFlowLayout 一起使用。

编辑:当我调用 [self.collectionView reloadData]; 时,数据源也没有被要求任何东西。

最佳答案

问题出在 UICollectionViewCell 上。高级描述是在移动动画期间从我的代码向单元格发送方法 actionForKey。它导致单元格保持在内部 being animated 状态。我找不到合理的解决方法并重构了一些位以避免 actionForKey 调用。现在一切都按预期工作。

关于ios - UICollectionView 在 moveItemAtIndexPath :toIndexPath: 后停止加载单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27315973/

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