Subjects

Monday, April 3, 2017

Topics

UICollectionView has always been a power plant. Its diversity and versatility are hard to underestimate.

We've covered it a little here on LBOC but we still have just scratched the surface. Today, we begin to dive deeper into what all it can do by adapting how new collective cells animate when they are inserted . Let us begin!

We start by creating a new single display app in Xcode . [1

9659000] We want to extract a UICollectionViewController ] in Interface Builder set its class to be ViewController one that accompanies ] Xcode Template and then Update ViewController [] [] [] [] [] [] ] ()

With this we have the best possible "boilerplate" layout. Only a few square, randomly colored cells fade in when they were inserted :

Not bad. Now let's customize the behavior of these cells as they are inserted . For this we need our own custom UICollectionViewLayout subclass.

In particular, we want the subclass UICollectionViewFlowLayout and override a few features to customize the behavior of [: [IC65ollectionViewFlowLayout var insertingIndexPaths = [ IndexPath [19659016]] () }