2016-04-26 3 views
6

जब मैं व्यक्तिगत रूप से एनिमेशन करता हूं तो सब कुछ ठीक काम करता है, लेकिन performBatchUpdates ब्लॉक के अंदर परिवर्तन तत्काल है, लगभग जैसे कि मैंने reloadData() कहा है। क्या मैं इसे सही तरीके से उपयोग कर रहा हूं?NSCollectionView performBatchUpdates परिवर्तन को एनिमेट नहीं करता

कार्य विधि:

NSAnimationContext.currentContext().duration = 0.25 

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

performBatchUpdates संस्करण (त्वरित परिवर्तन - कोई एनिमेशन):

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

में:

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

कोशिश यह इस तरह से डाल करने के लिए अन्य wo आरडीएस, इसे animator() प्रॉक्सी के माध्यम से पास करें।

संबंधित मुद्दे