[英]How to animate a UICollectionView Cell Become a circle With Swift?
[英]How do I animate UICollectionView insert with Swift?
我已经用collectionView.reloadData()尝试过了,但是实际上并没有解决。 我该怎么办?
如果您的collectionview只有一个部分,请尝试:
self.collectionView.performBatchUpdates({
let indexSet = IndexSet(integersIn: 0...0)
self.collectionView.reloadSections(indexSet)
}, completion: nil)
reloadData不会更改布局或设置动画。 您必须更改项目的位置,例如:
func shuffleTwoCells(srcIndex index1: Int, destIndex index2: Int) {
let firstIndexPath = IndexPath(row: Int(index1), section: 0)
let secondIndexPath = IndexPath(row: Int(index2), section: 0)
self.collectionView?.moveItem(at: firstIndexPath, to: secondIndexPath)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.