[英]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.