This is part of “Make my first iPhone app in 16 weeks” series.
- Controller – UICollectionViewController (native view controller for UICollectionView)
- View – UICollectionView
- UICollectionReusableView (Header/Footer/DecorationViews)
- Content – UICollectionViewDataSource & UICollectionViewDelegate
- Layout – objects that provide presentation logics for view objects
- UICollectionViewLayout – This is a blank slate layout object. You have to register view objects, add UICollectionViewLayoutAttributes objects that describe the presentation logic of each view object
- UICollectionViewLayoutAttributes – This provides the presentation logic for each view object.
- UICollectionViewUpdateItem – The layout object receives instances of the
UICollectionViewUpdateItemclass whenever data items are inserted, deleted, or moved within the collection view. You never need to create instances of this class yourself.
- Flow Layout (concrete subclass of Layout object)
- Flow Layout – comes with two optional supplementary reusable views (header/footer)
- UICollectionViewDelegateFlowLayout – Methods to work the flow layout
Configuration of views
- Registration views (If you registered the views in Storyboard, DO NOT register them programmatically)
- Register programmatically
Layout of views
- If you configured a cell without giving it a size, it will disappear. I configured a header view in Storyboard but didn’t give it a size through headerReferenceSize or collectionView:layout:referenceSizeForHeaderInSection: method, so dequeing the supplementary view kept throwing an error.