私はcollectionView.reloadData()でそれを試しましたが、実際にはうまくいきませんでした。私は何をしますか?SwiftでUICollectionViewのアニメーションをアニメーション化するにはどうすればよいですか?
0
A
答えて
-1
reloadDataはレイアウトを変更したりアニメーション化したりしません。上で見られるように
self.collectionView.performBatchUpdates({
let indexSet = IndexSet(integersIn: 0...0)
self.collectionView.reloadSections(indexSet)
}, completion: nil)
:あなたのcollectionviewが唯一つのセクショントライを持っている場合
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)
}
+0
しかし、これは2つを交換するためのもので、新しいものを挿入するのではありませんか? –
0
関連する問題
- 1. UICollectionViewをUIDynamics Swiftでアニメーション化する
- 2. これらのアニメーションを異なる時間にアニメーション化するにはどうすればよいですか?
- 3. CAKeyframeAnimationでCATransform3Dをアニメーション化するにはどうすればよいですか?
- 4. タップジェスチャーでUIImageViewをアニメーション化するにはどうすればよいですか?
- 5. PlayNでサークルをアニメーション化するにはどうすればよいですか?
- 6. * ngForをAngularでアニメーション化するにはどうすればよいですか?
- 7. このパスをアニメーション化するにはどうすればよいですか?
- 8. GeometryDrawingのプロパティをアニメーション化するにはどうすればよいですか?
- 9. スプライトをアニメーション化するにはどうすればよいですか?
- 10. JavaScriptパスをアニメーション化するにはどうすればよいですか?
- 11. イメージやImageViewのアニメーションをアニメーションに滑らかに変換するにはどうすればよいですか?
- 12. greensockアニメーションを元のアニメーションよりは逆だが速くするにはどうすればいいですか?
- 13. 「回転する」ようにビューをアニメーション化するにはどうすればよいですか?
- 14. アンドロイドスタジオのテキストをアニメーションにするにはどうすればよいですか?
- 15. AndroidでアニメーションGIFをトリミングするにはどうすればよいですか?
- 16. アニメーションでUIImageviewを表示するにはどうすればよいですか?
- 17. ページスクロールでアニメーションを実装するにはどうすればよいですか?
- 18. このonclickアニメーションをonloadアニメーションに変換するにはどうすればよいですか?
- 19. SwiftでUIScrollViewでzoomScaleをアニメーション化する
- 20. このアニメーションをミラーリングするにはどうすればよいですか?
- 21. リダイレクトの前にマウスのクリックで 'a'要素をアニメーション化するにはどうすればよいですか?
- 22. SwiftでNSLayoutConstraintをアニメーション化しようとしています3
- 23. jQueryで(スタイルプロパティではなく)属性値をアニメーション化するにはどうすればよいですか?
- 24. iPhoneアプリケーションでアニメーション化された.gifを使用するにはどうすればよいですか?
- 25. Velocityアニメーションをインストールするにはどうすればよいですか?
- 26. CSS3でSVGの特定の部分をアニメーション化するにはどうすればよいですか?
- 27. このアニメーションを元に戻すにはどうすればよいですか? Swift 3
- 28. three.jsでクラスから作成した配列をアニメーション化するにはどうすればよいですか?
- 29. Cocos2dなしでXcodeでスプライトシートをアニメーション化するにはどうすればよいですか?
- 30. iOSでストーリーボードセグを条件付きでアニメーション化するにはどうすればよいですか?
、あなたが使用する必要がある[例えばので あなたは、アイテムの位置を変更する必要がありますinsertItems(at:)](https://developer.apple.com/reference/uikit/uicollectionview/1618097-insertitems)メソッドを使用します。 コードスニペットがないため、一般的な質問ですので、[こちらの記事](http://rshankar.com/uicollectionview-demo-in-swift/) - * Insert Cell *どのように遊ぶことができるかをチェックします。 –
あなたのコメントは答えでなければなりません。 –