5. Crafting Custom Layouts Using UICollectionViewLayout

In the preceding chapter, I wrote that UICollectionViewFlowLayout is great for line-based, breaking layouts and that you should always resort to using it first. Sometimes, however, our layouts are sufficiently complicated to warrant the use of something more powerful. UICollectionViewLayout is the superclass of UICollectionViewFlowLayout and it is hands on. You are responsible for everything—the layout of cells, the size of the collection view—everything. We’ll take a look at an example where you’d want to use it, revisit decoration views, and explore a little bit of changing between layouts programmatically with animation. At the end of this chapter, we build a really cool photos application ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.