2016-04-26 13 views
6

アニメーションを個別に行うと、すべてがうまく動作しますが、ブロック内では、変更は瞬時に行われ、reloadData()とほぼ同じです。私はそれを正しく使用していますか?NSCollectionView performBatchUpdatesは変更をアニメートしません

の作業方法:

NSAnimationContext.currentContext().duration = 0.25 

indexPathChanges.map({collectionView.animator().moveItemAtIndexPath($0.0, toIndexPath: $0.1)}) 

performBatchUpdatesバージョン(インスタント変更 - なしアニメーション):

NSAnimationContext.currentContext().duration = 0.25 

collectionView.performBatchUpdates( { 
    indexPathChanges.map({self.collectionView.moveItemAtIndexPath($0.0, toIndexPath: $0.1)}) 

    // tried this as well - no luck  
    // indexPathChanges.map({self.collectionView.animator().moveItemAtIndexPath($0.0, toIndexPath: $0.1)}) 

}, completionHandler: {(finished) in print("Finished: \(finished)") 

答えて

2

このようにそれを置くようにしてください:

collectionView.animator().performBatchUpdates({<your animations>}, completion handler:{finished in <your completion handler>}) 

その他のrds、それをanimator()プロキシ経由で渡してください。

関連する問題