5. Crafting Custom Layouts Using UICollectionViewLayout

In Chapter 4, “Organizing Content with UICollectionViewFlowLayout,” I mentioned that UICollectionViewFlowLayout is great for line-based, breaking layouts. You also found out that you should always use it first. Sometimes, however, layouts are sufficiently complicated to warrant the use of something more powerful. UICollectionViewLayout is the superclass of UICollectionViewFlowLayout and it is work-intensive. You are responsible for everything—the layout of cells, the size of the collection view—everything. This chapter provides an example where you’d like to use it, revisits decoration views, and explores a little bit of changing between layouts programmatically with animation. At the end ...

Get iOS UICollectionView: The Complete Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.