0

ReloadItems 似乎不允许动画。

我尝试使用 collectionView:( willDisplay) 但 reloadItems() 实际上超过了动画(即切断它并重新加载单元格)

我尝试了 performBatchUpdates() 但在此块中出现 outOfRange 错误:

    collectionView.performBatchUpdates({
                    // reload one or more items
                    collectionView.reloadItems(at: [tappedArray[0], tappedArray[1]])
                }) { (_) in
                    // do animations here
                    if let cell1 = collectionView.cellForItem(at: self.tappedArray[1]) {
                        self.animateCell(cell1)
                    }
                }

如果重新加载 collectionView 中的单个项目,如何将动画添加到该项目的重新显示?

4

1 回答 1

0

问题解决:在闭包中完成的动画不在主线程上。由于所有动画都应该在主线程上,这导致我的 UI 出现故障,或者“不允许动画”。

于 2020-03-06T07:44:49.007 回答